passing a Vector3 value when creating a box

Discuss any questions about BEPUphysics or problems encountered.
Post Reply
Jack Burton
Posts: 12
Joined: Sun Nov 03, 2013 9:29 pm

passing a Vector3 value when creating a box

Post by Jack Burton »

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?
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: passing a Vector3 value when creating a box

Post by Norbo »

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.
Jack Burton
Posts: 12
Joined: Sun Nov 03, 2013 9:29 pm

Re: passing a Vector3 value when creating a box

Post by Jack Burton »

Thanks Norbo I should have known that :roll: 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
Post Reply