Suspend Dynamics?

Hi, I am looking how to disable dynamics temperarily for an object. I did a search but didnt find excactly what I needed.

I need this because:

A dynamic object (main character) needs to get into another dynamic object (a vehicle). Firstly, when you parent a dynamic object to something, it goes crazy and flies around. Secondly, a dynamic object cant really get into another dynamic object.

Any help would be much appriciated.


Well there IS the command suspendDynamics() in python. Here would be the usage:

cont = GameLogic.getCurrentController()
own = cont.getOwner()

To restore the dynamics, you use the same code except with a own.restoreDynamics(). However, any velocity that the character had when you suspended the dynamics WILL carry over when you restore them.

But for your particular issue, that’s probably not the best way IMO.

When it gets into the car, I would have you main character, the dynamic object, end. Then you can have the car make visible a non-dynamic copy of your dynamic object that would sit in the car. When you get out of the car, you’d re-add your main character.

Let me know if that makes sense!

Yes I thought of that too. The only problem though is that the dynamic object is carrying different properties that have changed. For example health may be at 30, and after you end the object, and make the new dynamic object once you get out of the car, the health is back at 100.

Either transfer the property at the time of the switch (via copy property actuator or messages) or store those properties somewhere else (like an overlay scene). That way they stay consistent throughout the level.

Could you please explain how to transfer the properties? That would be a lot of help

Thank you

setParent() function or actuator will do what you want (that’s new in 2.47): it will disable the dynamics on the object, make it ghost and parent it to the object that you pass in argument.

Now you can make the character climbing in the car using an armature Action + Ipo in Add mode. By combining Action and Ipo Add mode you can actually make your character do complex movements and end up in the car. Because it is ghost, it will go nicely through the car (make sure the door of the car opens at the same time). The fact that the character is parented to the car at that time is not a problem: Ipo works by setting the local position.

Synchronizing Action and Ipo is not difficult in the 3D view. The best is to put the character at [0,0,0] location and [0,0,0] orientation, position the car appropriately, build the Ipo and Action synchronously to make a natural movement and then transfer the Ipo to the Dloc and Drot curve. Ipo Add mode works equally with normal curves and delta curves but the latter are better because they don’t disturb the positioning of the character in the 3D view.

It’s a bit complex, I hope you get the idea.

uhh I’m a little confused. I parented it and everything, but when I put in an armerature, and make an action, right when I press play, the object moves to where it is parented. Even if it is not suppost to be parented yet.

I made a demo that illustrates this method: use the WAD key to move the ball next to the car and press space, the ball jumps in the car and after that the WAD key control the car. Press again space to get out of the car and continue to move the ball.
See the Ipo curves: I use delta curves only and they all start from 0.

umm when i press p to play, the ball suddenly moves toward the car, and then flies away…?

Here is what I mean (see attachment)


Hmm, it’s possible that it works only with 2.48. I don’t remember when I’ve implemented this feature precisely. It works well with the SVN version. Try with 2.48RC1, you should get better results.

I found away to change that, if you have your health or money or anything in another scene, and then set it as an overlay scene in your game / or whatever then you should be the same even when you change scenes or do anything that would normally change it back to the beginning. :yes:

ben2610: never mind i got it :wink: I just had to make the ball a ghost actor because it was colliding with the empty that had dynamics. It works great! Thank you a lot!

McBain: I can’t do that because the properties are being changed and you cant change one scene from another. And it isn’t about display, its about the acual property. Thanks anyways

Zootanore: ok I see what was going on: I was using for the ball a “No collision” mode that is actually very recent. This mode allows to skip the tedious process of defining a UV layer on every mesh objects and setting the collision flag to false on all faces. As you probably don’t have the most recent blender, the ball has a static physics shape by default and was interfering with the empty.

Sorry for the confusion. This will be available in the upcoming 2.48.

Here’s my little example:eyebrowlift:

CarTest2.47_17_02.blend (315 KB)

I got a little carried away making this and I think its way
more complicated than it need to be

I hope this helps