Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: FritsLyn on August 07, 2013, 02:08:33 AM

Title: Cross product - which vectors? [SOLVED]
Post by: FritsLyn on August 07, 2013, 02:08:33 AM
I have a fence: A-B
I have a car driving towards it.
I need to know at which vector3 in "World" the car will hit A-B.

I found how to do a cross product here:
http://hutonggames.com/playmakerforum/index.php?topic=271.0

And then I should just take cross from A+car..

But A and Car are in Unity-vectors, where we also have Rotation.. How on earth?

Which data goes where?

Thanks a bunch.
Title: Re: Cross product - which vectors?
Post by: escpodgames on August 07, 2013, 02:13:49 AM
The normal of the wall and the normal of the car? You can get the normal of a collision and feed it into the action ... is it dot product you want?
Title: Re: Cross product - which vectors?
Post by: FritsLyn on August 07, 2013, 10:31:14 AM
Oh, maybe it's because I do not know the right math expression, sorry.

I need to return the position where 'car' would hit 'wall'.

What would that be called, if not cross product? Is there a method?

Thank you very much.
Title: Re: Cross product - which vectors?
Post by: jeanfabre on August 08, 2013, 03:11:18 AM
Hi,

 simply perform a ray cast. it will give you the hit position, and normal.

have you tried that?


using pur math to do this will be difficult, because vector operator will give you directions, not "collision" info per say.

bye,

 Jean
Title: Re: Cross product - which vectors?
Post by: FritsLyn on August 08, 2013, 08:13:28 AM
The "wall" is not really there, it was invented so I could explain the math I needed to perform :)

Thank you a lot guys, I will have to rework things so I no longer need to know where one line (defined by game objects placement and direction) crosses another through math.

Cheers, and thanks again, you have helped me a lot :)

Frits