Ive been tying to pass a vector3 value when creating a box so that i keep track of its position
I have made a public Vector3 called shipPos and Ive been trying to pass the value into the create box like this
public Vector3 shipPos = new Vector3(0,4,0);
shipColBox = new Box(new Vector3(shipPos), 0.9f, 0.9f, 0.9f);
I keep getting the error "cannot convert from 'Microsoft.Xna.Framework.Vector3' to 'float'"
how would I pass in the shipPos?
passing a Vector3 value when creating a box
-
- Posts: 12
- Joined: Sun Nov 03, 2013 9:29 pm
Re: passing a Vector3 value when creating a box
At the moment, a vector is being passed into the constructor for a vector which is then passed into the box constructor. However, Vector3 has no constructor which takes a Vector3 (to have one would be a little silly, since it would amount to a copy).
So, rather than passing the shipPos into a Vector3 constructor which is then passed into the box constructor, just pass shipPos directly into the box constructor.
So, rather than passing the shipPos into a Vector3 constructor which is then passed into the box constructor, just pass shipPos directly into the box constructor.
-
- Posts: 12
- Joined: Sun Nov 03, 2013 9:29 pm
Re: passing a Vector3 value when creating a box
Thanks Norbo I should have known that
I don't know why I didn't see it must have been that Ive been starring at code for nearly 8 hours yesterday and not getting anywhere fast
