Jump to content

Custom Character Controller and AddForce


tjheldna
 Share

Recommended Posts

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!

trindieprod.png?dl=0spacer.png?dl=0steam-icon.png?dl=0twitter-icon.png?dl=0spacer.png?dl=0
Link to comment
Share on other sites

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.

trindieprod.png?dl=0spacer.png?dl=0steam-icon.png?dl=0twitter-icon.png?dl=0spacer.png?dl=0
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

trindieprod.png?dl=0spacer.png?dl=0steam-icon.png?dl=0twitter-icon.png?dl=0spacer.png?dl=0
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...