Michael_J Posted March 23, 2014 Share Posted March 23, 2014 From the testing I've done over the past couple of days, it seems that if I apply a force to an object that does not use gravity (regardless of the friction value) the object will eventually come to a stop. My only conclusion is that there is a global drag or other resistance occurring that is causing this (or some other form of forced restitution perhaps?). If this is the case is there any way to change this on either a global or per-object level (per-object preferably)? In the environment I'm working in (space) once an object is in motion it should remain in motion until something interferes with it, of course. Hence, I need to alter this behavior... Thanks... 1 Quote --"There is no spoon" Link to comment Share on other sites More sharing options...
tjheldna Posted March 23, 2014 Share Posted March 23, 2014 Are you using AddForce or SetVelocity? From my experience SetVelocity should keep you moving in that direction. I think as well you can have mass on it and it will still go in the direction you set and gravity doesn't effect it. Correct me if I'm wrong..... Quote Link to comment Share on other sites More sharing options...
Michael_J Posted March 23, 2014 Author Share Posted March 23, 2014 I tried both with the same result actually. Sorry, should have mentioned that... Quote --"There is no spoon" Link to comment Share on other sites More sharing options...
tjheldna Posted March 24, 2014 Share Posted March 24, 2014 I did this a while back for a projectile and I'm pretty sure it works like you need, it might help ya... This is called when the entity is created Shape *shape = Shape::Box(0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.3F,0.3F, 0.3F); entity->SetShape(shape); shape->Release(); entity->SetPhysicsMode(Entity::RigidBodyPhysics); entity->SetMass(1); entity->SetCollisionType(Collision::Trigger); entity->SetGravityMode(0); entity->AddForce(GetProjectileVelocity()); Quote Link to comment Share on other sites More sharing options...
Michael_J Posted March 24, 2014 Author Share Posted March 24, 2014 Thanks. I'll give it a test in a bit... Quote --"There is no spoon" Link to comment Share on other sites More sharing options...
Michael_J Posted March 24, 2014 Author Share Posted March 24, 2014 Yeah, still slowing to a stop. There certainly seems to be some sort of resistance at work here... Quote --"There is no spoon" Link to comment Share on other sites More sharing options...
tjheldna Posted March 24, 2014 Share Posted March 24, 2014 Sorry that's all I got =( Quote Link to comment Share on other sites More sharing options...
gamecreator Posted March 24, 2014 Share Posted March 24, 2014 I remember back in the day someone was having physics issues with a miniature golf game they were doing. Not sure if it's strictly related or if it was solved but may be worth a search. Edit: come to think of it I think it was that the golf ball stopped instantly on hitting a wall. Probably not related. Quote Link to comment Share on other sites More sharing options...
Michael_J Posted March 24, 2014 Author Share Posted March 24, 2014 No worries. Thanks for trying @gamecreator -- thanks, I'll have a search... Quote --"There is no spoon" Link to comment Share on other sites More sharing options...
Einlander Posted March 24, 2014 Share Posted March 24, 2014 Would setting the friction to 0 do anything? http://www.leadwerks.com/werkspace/page/documentation/_/command-reference/entity/entitysetfriction-r142 Quote Link to comment Share on other sites More sharing options...
Michael_J Posted March 24, 2014 Author Share Posted March 24, 2014 No, sadly--as I said, the friction value, 0.0 or otherwise, doesn't seem to matter.... Quote --"There is no spoon" Link to comment Share on other sites More sharing options...
YouGroove Posted March 24, 2014 Share Posted March 24, 2014 In the environment I'm working in (space) once an object is in motion it should remain in motion until something interferes with it, of course. Hence, I need to alter this behavior... AddForce will add a force and the objects will finish to stop after some time. SetVelocity : the object will move at constant speed , it's what i use for bullets : No gravity, a mass , and SetVelocity What do you need ? object always moving in space , even without any force applied ? If that you'll have to code it yourself like : - detect object velocity - if very slow velocity or 0 almot velocity : apply some rotating or moving continuous small forces to simulate space For example : SetOmega() : to make it turns slowly and constantly in space Quote Stop toying and make games Link to comment Share on other sites More sharing options...
tjheldna Posted March 24, 2014 Share Posted March 24, 2014 SetVelocity() every Update? Just a thought also, maybe there is a child node of your object with physics set unknowingly? or something else weird like that. I don't even know if would matter or not. I'm positive SetVelociy() does it. Quote Link to comment Share on other sites More sharing options...
tjheldna Posted March 24, 2014 Share Posted March 24, 2014 Ok I just did a quick test myself. You are right Michael, over time with SetVelocity() the entity does slow down indeed. I had Friction = 0, Mass = 1, Gravity Mode = 0. Is it possible its a bug? Maybe it behaved the way I expedted the last time I used the function in an earlier build? Anyway Calling SetVelocity() every update does work. Quote Link to comment Share on other sites More sharing options...
thesword Posted August 30, 2014 Share Posted August 30, 2014 Hi, does anyone figured out how to disable this drag? Quote Link to comment Share on other sites More sharing options...
bandrewk Posted September 25, 2014 Share Posted September 25, 2014 Bump, I am also interested in a solution. Quote Link to comment Share on other sites More sharing options...
Josh Posted September 25, 2014 Share Posted September 25, 2014 All computer physics simulations use a small amount of linear and angular damping. The reason for this is that floating point calculations are never 100% precise. Each frame they will be slightly too much or slightly too little. The worst situation is when they consistently get to be more and more energetic each frame, because it can accumulate and cause explosive creation of energy. Damping ensures that the calculations are always on the conservative side, and it also acts as an approximation of friction. Of course in a perfect frictionless vacuum this can cause behavior that was not intended. 1 Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Michael_J Posted September 25, 2014 Author Share Posted September 25, 2014 Yeah, I figured that's what was going on. Out of curiosity, I believe Newton allows for collision detection without updating physics (using this thread as a basis for this assumption: http://newtondynamics.com/forum/viewtopic.php?f=9&t=4475&p=36406&hilit=+collision+only+#p36406). Is this possible via Leadwerks integration? I mean I know I could set my on collision responses with type trigger and use the callback; but does this cause only the collision to be updated via NewtonCollisionUpdate() instead of calling NewtonUpdate() (which updates collision AND physics)? If not, could a bool flag for "collisions only" be added to Leadwerks::World? http://newtondynamics.com/wiki/index.php5?title=NewtonCollisionUpdate From remarks: " This function shall be used ONLY when Newton is used as a standalone collision library. Use NewtonUpdate if you are also using rigid body dynamics" Thanks... Quote --"There is no spoon" Link to comment Share on other sites More sharing options...
Josh Posted September 25, 2014 Share Posted September 25, 2014 If you can dive into C++, you can do anything Newton supports. However, I wonder if lessening the angular and linear damping might be enough. That's certainly easier than creating your own physics simulation. There presently are not Leadwerks commands for this, but it's just two Newton commands to call. Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.