Forum

Gravity toggle on and off

25 November 2015 07:04
Hi all. How do you change the gravity for the world or the object to zero? It seems there isn't an option for this. Please help as I'm trying to make a 3D fish swim in the sea.
26 November 2015 10:56
Good day.
If you don't need your object to collide with anything, you can just leave physics for it turned off.
Blend4Web team - Editor
26 November 2015 12:38
Hi, thanks for replying.
I do need to check for collision later on. Is there any other way to turn off the gravity and have physics for the fish?
26 November 2015 16:10
Hi.

Try to use static physics type. Not Rigid Body. It will provide and detect collisions. If you want only detect collisions, you should enable the "Ghost" object physical property.

And don't forget, that if the object uses physics you should use the "physics" methods to translate and rotate object.
27 November 2015 06:04
Hi, thanks for replying.
If the object is static, how do you move it from point A to point B? How do I go about using the "physics" methods to move the object?
27 November 2015 10:25
Hello,

You can use the following method: set_transform

[EDIT]
I forgot to mention one important aspect. As this object is static it will only move its physical entity and won't affect rendering. Thus, we need to move it on the rendering side as well.

m_phy.set_transform(object, trans, quat);
m_transform.set_translation(object, trans)
27 November 2015 12:11
And here is the example. I've combined this lesson and this example.

example_37c.zip
30 November 2015 06:14
Thank you all. Case closed.
28 October 2016 15:11
Hello,
I am making a simulation of planetary gravity, and so I needed the scene or world to have zero gravity.
If I set the objects as static the set_translation does not work because the object should be dynamic.
But if I use dynamic/rigid, the objects fall (with gravity). I followed the example here: https://www.blend4web.com/en/community/article/254/
But I wonder how you were able to do the translation??
28 October 2016 15:22
Please do not reply here. I made the same question in the link I provided.
 
Please register or log in to leave a reply.