Jump to content
Lethal Raptor Games

UpVector

Recommended Posts

Vector seems to constrain the child enity well but setTargetPosition dosnt seem to work and there is no other way to move the joint.  🤔  unless I parent it to another entity maybe, but that might defeat the purpose...

Share this post


Link to post

I've tried this but it doesn't work for me.  I'm calling SetTargetPositon() but else where I'm calling AddForce() to the child of that joint to simulate gravity.  This seems like it may be bad?

Share this post


Link to post

Ah I see what you mean now.  I got it to work but the kinematic joint still gives me trouble where the object will drag across the ground and jitter.  I think the problem is, it drags and gets a new rotation, and then next frame the target rotation is set, causing a jitter between the two.  Is Joint::Vector() able to be moved at all?  I know it can be moved around if something hits it, but I want to add forces to it...

Share this post


Link to post

You only need to set the target rotation once really. The joint will continually move to that orientation.

  • Thanks 1

Share this post


Link to post

I don't understand what behavior you are describing, but I think that only the character controller is appropriate for characters. If you try to do it with realistic physics there will always be some unwanted behavior caused by the forces used to keep the object upright.

Share this post


Link to post

Want I want is exactly what you have done with your character controller, but align to different gravity directions.  What I'm doing to try and achieve it is this;

  • Create Capsule Shape
  • Apply constant force of gravity
  • On Actor::Collision();
    • Store collision point and normal
    • Store collision time
    • Turn off gravity
    • Set Velocity to 0
  • On UserInput to move;
    • Create Plane with the normal and position
    • Use angle of character to find a point exactly 1 unit away
    • Intersect the plane with a ray aligned with gravity at that move point
  • Move capsule with SetVelocity() or PhysicsSetPosition()
  • In Actor::UpdateWorld();
    • Use PhysicsSetRotation() to align the capsule with gravity
    • Speed = GetVelocity().Length()
    • If speed is not 0 and the collision time is greater than 100ms ago, enable gravity.

Using a kinematic joint has the same problems as above but with the addition of slowly rotating to align with gravity and not being snappy when moving to the target unless mass is really really low.

I've also tried, setting the collision response off for the capsule and finding all entities in the AABB around the capsule, and ray casting each shape to find the collision point.  This work smoothly and was great except FPS dropped from 100 to 70 (just with one Pick per frame as it was moving) so this was not ideal.  The fact that this worked told me that the problem lies with the capsule still colliding with the ground as I move it.

 

I think what I want can only be done under the hood with newton commands.

 

 

 

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

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.

×
×
  • Create New...