SpiderPig Posted May 21, 2019 Share Posted May 21, 2019 Now this looks like somthing I need. ? Hard to impliment? Quote Link to comment Share on other sites More sharing options...
SpiderPig Posted May 23, 2019 Author Share Posted May 23, 2019 So I found this; Joint::Vector(). Anybody have an idea how to use it? It seems to pin the child correctly but I can't get it to move around... Quote Link to comment Share on other sites More sharing options...
SpiderPig Posted May 23, 2019 Author Share Posted May 23, 2019 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... Quote Link to comment Share on other sites More sharing options...
Josh Posted May 23, 2019 Share Posted May 23, 2019 Use a kinematic joint and set the angular friction to zero: https://www.leadwerks.com/learn?page=API-Reference_Object_Joint_SetFriction 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...
SpiderPig Posted May 24, 2019 Author Share Posted May 24, 2019 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? Quote Link to comment Share on other sites More sharing options...
Josh Posted May 24, 2019 Share Posted May 24, 2019 You should set the rotation not the position: https://www.leadwerks.com/learn?page=API-Reference_Object_Joint_SetTargetRotation 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...
SpiderPig Posted May 24, 2019 Author Share Posted May 24, 2019 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... Quote Link to comment Share on other sites More sharing options...
Josh Posted May 24, 2019 Share Posted May 24, 2019 You only need to set the target rotation once really. The joint will continually move to that orientation. 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...
SpiderPig Posted May 24, 2019 Author Share Posted May 24, 2019 Ah okay. But it will still flex around when it is hit, which isn't ideal for a character controller. Quote Link to comment Share on other sites More sharing options...
Josh Posted May 24, 2019 Share Posted May 24, 2019 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. 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...
SpiderPig Posted May 24, 2019 Author Share Posted May 24, 2019 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. 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.