Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / Newton joints problem

Author
Message
SimSmall
20
Years of Service
User Offline
Joined: 7th Aug 2004
Location: United Kingdom
Posted: 26th Dec 2006 22:29
I'm going to stick this in the newcomers board, since it's very probably a simple mistake, but one that's had me clueless for some time now, and it's embarrassing since I rarely need to ask for help... Here goes:

Right now I'm just messing about with 2 boxes, and trying all the types of joint on them, to see how the joints behave. I started out with ball/socket, and already I'm not quite getting something

I'm successfully managing to create the boxes, and apply gravity to them. but when I create the actual joint. me and newton are not agreeing...



I'm making two boxes each with dimensions of 5x2x1. then positioning the first box at 0,0,0 and colouring it red. I then position the second box at 5,0,0 and colour it blue. then using the snippet above, I make the joint. But it's not being created as I'm expecting it to be... I made a few milkshape mock-ups to help try and explain better...


Here is where I'm intending the boxes and the joint to appear

and a wireframe view so the joint (blue circle) is properly visible

The position I want the joint at is in the middle-point between the two boxes, which to me is 5.0,1.0,0.5

But that's not what seems to be happening...
instead it seems to be placing the joint here

and a wireframe view

Can anyone see why I've got this wrong? Without the SetMatrixRecursive command, the boxes at least appear in the right place (but the joint is still in the wrong place). I assume it is setting temp vector 2 that is throwing it since I want the pin to point straight to the right, which in my opinion is 0,90,0, but the included tutorial "demo 3" says down is 0,-1,0


Here's the entire source in case the error is somewhere else.
The 2 external x files can be generated internally with make object box, or a modelling program could be used:

world.x is 50x10x50 units
box.x is 5x2x1 units



I'd appreciate any help, since I think I'm almost all the way there...
SimSmall
20
Years of Service
User Offline
Joined: 7th Aug 2004
Location: United Kingdom
Posted: 27th Dec 2006 16:19 Edited at: 27th Dec 2006 16:19
As is typical with me, 1 day after I post, I find the solution...
So yes, if I'd posted tonight, I'd have found the answer tomorrow morning...

the sizes of the boxes were right. and I could have sworn I exported them with the vertices in the right places, but apparently not...

I assumed the Back-Lower-Left corner point was at 0,0,0 and the Front-Top-Right point at 5,2,1 -- putting the centre of the box at 2.5,1,0.5
But no, the the Back-Lower-Left corner was at -2.5,-1,-0.5 and the Front-Top-Right at 2.5,1,0.5 which leaves the centre of the box at...
yep, 0,0,0 - where I thought the Back-Lower-Left corner was.

Move the joint position
from 5.0,1.0,0.5
to 2.5,0.0,0.0

and everything works hunky-dory...
Sorry if anyone else got a headache reading this and got equally confused trying to make any sense of it. But it's solved now

Oh, and I didn't edit the initial post in case someone just scanned over it then went to work out a solution to my problem... In most other cases I would edit.

Login to post a reply

Server time is: 2024-11-26 05:41:18
Your offset time is: 2024-11-26 05:41:18