Math question: How to project a rotation in plane?

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

Math question: How to project a rotation in plane?

Postby Auradrummer » Mon Sep 21, 2009 9:26 am

Hello guys!

I'm with a little problem here:
I need to cast downward three rays from an object. The problem I'm facing is to calculate the destination point to be exactly under the origin point, even if the object turns. To do this, I think I need to project a rotation matrix in the plane (like a mid day sun shadow). How can I do this?

Thanks.
Developing a racing game.
Auradrummer
 
Posts: 132
Joined: Sat May 17, 2008 9:17 am

Re: Math question: How to project a rotation in plane?

Postby JernejL » Mon Sep 21, 2009 9:50 am

Auradrummer wrote:Hello guys!

I'm with a little problem here:
I need to cast downward three rays from an object. The problem I'm facing is to calculate the destination point to be exactly under the origin point, even if the object turns. To do this, I think I need to project a rotation matrix in the plane (like a mid day sun shadow). How can I do this?

Thanks.


You just take the origin point as ray origin, and the target point from local space transformed with the object's newton body matrix as target point.
Help improving the Newton Game Dynamics WIKI
User avatar
JernejL
 
Posts: 1587
Joined: Mon Dec 06, 2004 2:00 pm
Location: Slovenia

Re: Math question: How to project a rotation in plane?

Postby Auradrummer » Mon Sep 21, 2009 5:58 pm

Hi Delfi,

Doesn't work. This is how I'm using. But, I want that the ray is always verical to the global space, not to the caster. Like the ray is dropping from the body, got it? IF the body inclinates, the ray cannot inclinate. I tried to not transform, only add it to the matrix.m_posit, but in this case I miss the heading of the objects.
Developing a racing game.
Auradrummer
 
Posts: 132
Joined: Sat May 17, 2008 9:17 am

Re: Math question: How to project a rotation in plane?

Postby JernejL » Tue Sep 22, 2009 4:40 am

Auradrummer wrote:Hi Delfi,

Doesn't work. This is how I'm using. But, I want that the ray is always verical to the global space, not to the caster. Like the ray is dropping from the body, got it? IF the body inclinates, the ray cannot inclinate. I tried to not transform, only add it to the matrix.m_posit, but in this case I miss the heading of the objects.


If you want the ray to always be aligned by gravity, then what is the problem? and what has heading to do with raycasts? rays don't have any heading if they "follow the gravity".
Help improving the Newton Game Dynamics WIKI
User avatar
JernejL
 
Posts: 1587
Joined: Mon Dec 06, 2004 2:00 pm
Location: Slovenia

Re: Math question: How to project a rotation in plane?

Postby Auradrummer » Tue Sep 22, 2009 10:04 am

Delfi,

Yesterday this problem seemed to be so difficult. I spent ours before asking for help. Today, when I woke, I saw how stupid is it. Is only to subtract some value in Y that the ray goes down as I wanted.

Sorry to post so stupid question! But this happens with everyone (I hope)!
Developing a racing game.
Auradrummer
 
Posts: 132
Joined: Sat May 17, 2008 9:17 am

Re: Math question: How to project a rotation in plane?

Postby JernejL » Tue Sep 22, 2009 10:32 am

no problem, i'm happy you solved it :)
Help improving the Newton Game Dynamics WIKI
User avatar
JernejL
 
Posts: 1587
Joined: Mon Dec 06, 2004 2:00 pm
Location: Slovenia


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 1 guest