Sorry for asking again. I didn't explain my question well last time:
I want to my imp grabs the ball, aim somewhere, and release it. Something like the screenshot below, but I don't know how aiming.
In a post, I saw someone used Force Applier with Advance Rotator for a cannon and thought that it could be used for the ball too, but it still didn't work.
I updated the element last night with simpler logic on the grab cube. I think it's quite a cool mechanic and now I'm wondering how it can be used...some kind of mini-golf like game maybe? :hmmface:
Wow! Thanks, man. I had no idea that it could be this complex (for me, of course). I tried it, and now I think possessing the ball and using buttons (like left analog for changing direction and R2 for releasing) is better. With the 'Grab Force Applier' you made, hope that I'll get to that sooner. And thank's for describing the process.
OK I think I have fixed it! Simpler logic, too...
Look for 'Grab Force Applier' in the Dreamiverse (or my username)
it's probably not 100% what you want, but you can grab the cube and drag it to fling it in a direction when releasing. Summary of what's going on:
- An object follows the imp, with a tag on it. It transmits its position constantly.
- When you grab the cube, it sets its 'movable' flag to false so it doesn't get dragged about by the imp (worth noting that you can grab invisible objects if you need that)
- When you release, the imp stretch value is transmitted for 1 frame only, and the object set back to movable.
- A force applier in the scene receives the stretch value ("Release Strength") and the imp position. The strength of the force is in the force applier itself; the Release Strength receiver just multiplies it. The imp position receiver tells the force applier where to apply the force from.
I had to set the walls/floor in the room to not collide with imps to be able to fling things upwards.
-edit- OK actually it's not 100% reliable. If I modify the microchip and then undo, it stops working again...frustrating. I can't look at it any more for now, but I still think a way of delaying the imp stretch and position values being updated is needed.
I have a solution for you, just wrapping some things up and I can share the sceneand explain here.
Gah, I had it now its being annoying and broken. Trying to save the imp stretch value when grab is released.
I will explain what I am trying, and the problem I have. You can make an object follow the imp using a Control Sensor. If that object has no collision, and does not interact with imps, then you can use it to figure out where the imp is in the scene pretty much. So I put a tag on the object, and transmitted the scene position of the tag. Then have a force applier, and use a signal receiver to get the transmitted imp tag position and wire that into the force applier's Target Position. Now you have a force applier where the imp is!
Then, transmit the imp grab strength to the force applier, but only once the object has been ungrabbed, and for 1 frame only. That should result in a force being applied to the object from the imp position at a varying degree of strength based on the imp stretch.
The problem I have is once the object is ungrabbed, the imp stretch value becomes 0, and the position snaps to near the screen. I thought I could store the imp stretch in a variable and only update the variable whilst grabbed, and this worked for a while but I think I was just lucky - it stopped working after I modified the microchip despite the logic being the same. I think it's unreliable and based on microchip update order - sometimes the imp strength variable doesn't update to 0 when ungrabbed, and sometimes it does.
The same goes for the imp position; when ungrabbing the imp position snaps to the front of the camera. Before, the force was being applied where the imp was whilst grabbed, but now it's being applied where the imp is after grabbing.
If we can figure out how to store the imp strength and cursor position for 1 frame after grabbing, then this could be a solution for you.
This was the first thing I tried, but the problem is I couldn't find the way that you mentioned. That's why I went after other ideas like possessing the ball and sliding it by a button. So if the player holds the button, it will go further, but I didn't know how to do this too. Thank's for your idea.
I'll have a look at this later, but you'll certainly want a Grab Sensor, then some way to get a strength of the grab and the direction the imp is pulling in.