tjheldna Posted March 3, 2014 Share Posted March 3, 2014 Hi, Just wondering if someone knows a solution to my problem. I'm creating a custom character controller with a rigid body object. I'm using AddForce to push the character which is working. My problem is when I turn the object. As the character turns there must still be a residual force still being applied in the old direction. Although the new directional force is being applied and the character starts to drift. I'm using PhysicsSetRotation for the rotation of the object. Any one know what I need to do to stop this drifting (Physics isn't a strong point)? Thanks! Quote Link to comment Share on other sites More sharing options...
gamecreator Posted March 3, 2014 Share Posted March 3, 2014 My thought would be to use GetVelocity and apply an opposite force but there may be a better way. Quote Link to comment Share on other sites More sharing options...
beo6 Posted March 3, 2014 Share Posted March 3, 2014 Hmm. I think that depends on what you are trying to do. But you could try to make the friction higher so it stops quicker. Quote Link to comment Share on other sites More sharing options...
Flexman Posted March 3, 2014 Share Posted March 3, 2014 If you increase the LinearDamping that should increase the friction. That's the easy way. The alternative is to start getting into cancelling out forces (get/set velocity etc) as others mentioned above. Quote 6600 2.4G / GTX 460 280.26 / 4GB Windows 7 Author: GROME Terrain Modeling for Unity, UDK, Ogre3D from PackT Tricubic Studios Ltd. ~ Combat Helo Link to comment Share on other sites More sharing options...
tjheldna Posted March 4, 2014 Author Share Posted March 4, 2014 I'm basically creating a quick prototype of an idea I had and am seeing if it is at all possible in Leadwerks 3. In the game you control a 4 legged animal so conforming to the terrain is needed. In LE3 friction seems to be the only attribute exposed for physics objects no linear/angular damping or restitution exposed. Quote Link to comment Share on other sites More sharing options...
beo6 Posted March 4, 2014 Share Posted March 4, 2014 I have created exactly for this issue a script. See here: http://leadwerks.wikidot.com/wiki:align-to-ground That should help you align your animal to the ground. According to josh AlignToVector should work but i was not successful with that method. 1 Quote Link to comment Share on other sites More sharing options...
tjheldna Posted March 5, 2014 Author Share Posted March 5, 2014 Thanks beo6 translated to C++ and is working! Quote Link to comment Share on other sites More sharing options...
beo6 Posted March 5, 2014 Share Posted March 5, 2014 Hello, nice that it helped. Have you also tried using AlignToVector() ? See here how i think it should be used: http://www.leadwerks.com/werkspace/topic/8786-can-model-be-rotated-by-quaternion-lua/#entry67946 However in my tests the last parameter for the rotation never had the desired effect and it seems everytime i come up with the issue no one answers just like everyone is avoiding this. (sounds odd i know. ) and i still don't know if that is a bug in AlignToVector or if i am just using it wrong. Quote Link to comment Share on other sites More sharing options...
tjheldna Posted March 5, 2014 Author Share Posted March 5, 2014 I haven't tried AlignToVector as it was getting a little late last night, but I'll give it a go and if I do I'll let you know. Event if I don't, the way it is now is perfect. Also do you wan't me to post the C++ code for the align to terrain part? It wasn't hard to do but, this could be real useful for anyone trying to do prone for a character or an animal like I'm doing. Thanks again. Quote Link to comment Share on other sites More sharing options...
beo6 Posted March 6, 2014 Share Posted March 6, 2014 Sure. go ahead. i ported it myself from a post i think from the Unity forums with checking for similar methods in Leadwerks 3. Looking forward if you are more successful with the AlignToVector() method. If not i will need to make a small test project and post it in the bug forum i think. Quote 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.