force effect

Ok. So i’m trying to achieve something like force grip/force push/lift effect.
First i’m trying to do the force push and make the object move depending on where the “character” is placed. So that the cube/object will move in the opposite direction the user is facing, like push away from yourself, and also something like lift/levitate object.
Is there a script or has somebody done this before? I’ve searched the forum for this.

i tried doing mouse over + a keyboard key - motion (force and a direction) but that only made it move in the given direction that was set in teh “motions” tab, and i need it to move away from the character/the way the mouse is pointing. And the levitate object i still havent started on.


Wrong place!

Hi. First this should go in the support/discussion subforum, not work in progress.

I guess you could use the players position and objects position to calculate the angle of pushing/pulling.
edit: here I made a quick example. No movement because…well it’s boring to set up.

I hope you know enough python to know where to change stuff to make it fit with your game (if you have maid it yet). It is force push with left mouse button and pull with right. Any questions, just ask.

edit2: a little mistake in the code. New version uploaded


force.blend (153 KB)

Thanks for the blend. More or less what i wanted for the push,pull effect :D, i’ll look it over and make it fit. Guess i’ll have to find the levitationgun/gravitygun and see how that works, to get the other effect i want. Thanks again Sim88

When applying the script and all that to my blend file, it works, but only on one object. If i add new objects either create them from the start or copy it, only the last created object reacts. no matter where i point, or which place my mouse is afterwards, the obejct still reacts. meaning first i go place the cursor over the object press left-click or right-click, i can then turn, or walk to the opposite of the whole level, and still the object reacts, so it seems as the obect doesn’t get deselected after it gets selected, and i also seems that only one object reacts. Anyone got any idea how I would go about fix this?


EDIT: Solved the problem. Was missing “mouse over” :stuck_out_tongue: