A place to discuss everything related to Newton Dynamics.
Moderators: Sascha Willems, walaber
by leakingpear » Thu Dec 03, 2009 9:28 am
Hey everyone, i'm having alot of trouble getting mouse dragging using slider joints (or any other joints) working, mainly because I don't understand the pin concept.
As it works currently, every time the mouse button is clicked down it creates a null collision body at the point of the click, along the same plane as the object being dragged (it's a top down interface with all the objects that need dragging being on a the XZ plane with a specific and constant height). I then create the joint attaching the two objects together, but I don't really understand the position and pin variables. I've tried setting the pin to be a the direction vector of the object to the mouse position, i've also tried setting it to be pure Y up (which resulted in a somewhat better if still completely wrong result).
I don't understand how the pin direction can be global when the two bodies are moving and therefore the direction will change all the time, I don't really see the need for it if there's two objects being attached together and there doesn't seem to be any way to update it.
I just want to implement fast and responsive mouse dragging with collision that works correctly, I implemented it using manual velocity changes fine but that causes collision problems with walls for obvious reasons.
Any help at all would be really fantastic as i'm horribly confused at this stage.
-
leakingpear
-
- Posts: 3
- Joined: Sun Mar 18, 2007 9:40 pm
by Julio Jerez » Thu Dec 03, 2009 9:50 am
leakingpear wrote:I don't understand how the pin direction can be global when the two bodies are moving and therefore the direction will change all the time, I don't really see the need for it if there's two objects being attached together and there doesn't seem to be any way to update it.
the pin is global because when you create a joint it is teh only way to specify a parameter the is common two the two bodies.
the joint calculate and save the local space of the pin for each body part,
in the constraint call back it calculate a new global global space of pin in body one a global space pin in body two. issue teh force for make sure the two pins are the same.
-
Julio Jerez
- Moderator

-
- Posts: 12426
- Joined: Sun Sep 14, 2003 2:18 pm
- Location: Los Angeles
-
by leakingpear » Thu Dec 03, 2009 11:12 am
I still don't really understand what the pin does and how i'm meant to update it when there doesn't seem to be any function for it. Shouldn't the direction of the slider joint for each body just the direction to each other, or to the updated position? Is there any way you could explain it relative to the mouse dragging i'm trying to accomplish?
-
leakingpear
-
- Posts: 3
- Joined: Sun Mar 18, 2007 9:40 pm
by Julio Jerez » Thu Dec 03, 2009 11:20 am
the pin is the joint direction. for a slider it is the direction along which the body move.
the joints are updated in the constraint callback.
-
Julio Jerez
- Moderator

-
- Posts: 12426
- Joined: Sun Sep 14, 2003 2:18 pm
- Location: Los Angeles
-
by leakingpear » Thu Dec 03, 2009 11:36 am
I don't understand how I can update the pin when the NewtonHingeSliderUpdateDesc only has acceleration and min/max friction in it and that appears all I can change, once the pin is set it doesn't seem like you can update it locally or otherwise unless i'm missing some obvious function (i've looked through 10 times now), even if it's setting it locally for each body that would be fine but I don't see any way to do so. Also i'm using 1.53 with OgreNewt (although i'm editing OgreNewt as needed). I just want to have an object be consistantly pulled towards a point directly along a direction vector, while doing it manually with just forces results in overshooting and momentum that prevents it being precise.
-
leakingpear
-
- Posts: 3
- Joined: Sun Mar 18, 2007 9:40 pm
Return to General Discussion
Who is online
Users browsing this forum: No registered users and 1 guest