Skip to main content

Beginner Question about Vector3d

2 replies [Last post]
Omnipotence
Offline
Joined: 2011-04-08
Points: 0

I am very confused about Vector3d objects. Can someone explain them to me?
I am working on a simple game in which you fire projectiles, which means I must create a vector from the player position (which is constant, they just rotate around) in the direction they are facing, and check whether the enemy is along the vector, correct? But a Vector3d only has one set of coordinates. Wouldn't it need 2? A starting point and a second point to define direction? What am I missing here?
Thank you.

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
PaulHoll
Offline
Joined: 2011-11-22
Points: 0

Subtract the starting point's coordinates from the end point's coordinates to get and i, j, k to make up the vector. You're likely to want to 'normalize' the vector. PH

harshadbits
Offline
Joined: 2010-12-10
Points: 0

The first point is taken as the origin of the VirtualUniverse.