I am a somewhat experienced Blender user and I’m just getting back into Blender again
I have been having problems with the movement of the character in a game I just started on yesterday. I settled on using servo for it, but I have a problem where if you walk into a wall and then stop, the character bounces back. I have tinkered around with anything I could think of to fix this problem, but nothing works.
So, my plan is to, in Python, completely stop the object from moving upon the release of the key. That way the character won’t bounce off the wall. I don’t want to disable the object’s dynamics though. That’s just about the only way I could think of fixing it. If anyone else has other ideas, please tell me.
Try messing with the wall’s restitut value. This is in the material buttons.
Add a material to the wall, select the “DYN” option near the color sliders, and lower the restitut value. Restitut is essentially the “bounciness” of the faces. Set this for 0 for the wall and your character should stop bouncing. You could also do this to your character.
For stopping an object completely (without python) you can use Servo. Just select 0 for the x, y, and z, and add both a min and a max force for all 3 axis.
No I already tried that and it didn’t work. And the restitute just makes it worse. I just need to know how to stop an object completely in python. I’m pretty sure I can get it to work then
Oops, sorry about that! I was mixing it up with the motion actuator’s setLinearVelocity() method, which takes 4 args. Yes, use a list or tuple for KX_GameObject.setLinearVelocity():
ob.setLinearVelocity([0, 0, 0], 1)
# or
ob.setLinearVelocity((0, 0, 0), 1)