playMaker

Author Topic: Cross product - which vectors? [SOLVED]  (Read 4049 times)

FritsLyn

  • Full Member
  • ***
  • Posts: 191
Cross product - which vectors? [SOLVED]
« 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.
« Last Edit: August 08, 2013, 08:20:12 AM by FritsLyn »

escpodgames

  • Hero Member
  • *****
  • Posts: 687
    • Assets
Re: Cross product - which vectors?
« Reply #1 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?

FritsLyn

  • Full Member
  • ***
  • Posts: 191
Re: Cross product - which vectors?
« Reply #2 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.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Cross product - which vectors?
« Reply #3 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

FritsLyn

  • Full Member
  • ***
  • Posts: 191
Re: Cross product - which vectors?
« Reply #4 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