Hi there!
I just spawning new entity by mouse button, and they always rotate on terrain and then fall into ocean, how to stop this rotation with friction?
This code seams to be not working properly, entity still have endless rotation behavior on terrain.
IMaterial mat = Global.gEnv.p3DEngine.GetMaterialManager ().LoadMaterial ("assets\\materials\\spheremat.mtl"); mat.GetSurfaceType ().GetPhyscalParams ().bouncyness = 0.1f; mat.GetSurfaceType ().GetPhyscalParams ().friction = 0.1f; ent.BaseEntity.SetSlotMaterial (0, mat); ent.BaseEntity.SetMaterial (mat);
i don't use C# but,
- GetPhysicalParams() returns const object, it shouldn't allow you to modify it.
- haven't tryed myself, but you can try this (pseudo)code, despite i was looking for angular damping i can't find it anywhere
=================================
pe_simulation_params psc;
entity.GetPhysics().GetParams(ref psc);
psc.damping = 0.2; // play with values
entity->GetPhysics()->SetParams(psc);
=================================
if this helps - this means sphere doesn't really do any friction but just rotates. that's how most physics engine works and why you need angular damping
Thanks for info! But if I set this damping spheres still have "lazy rotations" on terrain and fall into ocean when my little terrain ends
there is my code:
IPhysicalEntity phy = ent.PhysicalEntity; if (phy != null) { pe_simulation_params param = new pe_simulation_params(); param.type = (int)EPE_Params.ePE_simulation_params; phy.GetParams (param); param.damping = 1.8f; phy.SetParams (param); }
I'm also do not find how to able set the angular damping factors (
I think maybe there is also exist some kind of wind forces affects onto spheres ?
Answer by FluffyTail-1 · Aug 28, 2016 at 06:08 AM
this is example of this effect with endless movement (to left on video below), how to stop this ?
camera also moved by it self, I do no not pressing anything in time of slow-motion to the left https://youtu.be/ArB6XGklQp0