
04-02-2012, 05:01 PM
|
 |
Ultimate Contributor
Preferred language: C#, VB
|
|
Join Date: Jun 2003
Location: USA
Posts: 2,096
|
|
Re: Debug error "Cannot convert from double to float...
You're code is a bit hard to read. While that might sound nit-picky, and it's a subjective thing, when code is more readable, it is easier to understand and reason about it, especially at a glance. It also helps us help you.
The documentation for Vector3 states that the fields are floats, not doubles. You either need to cast to float, or make sure that all of your variables are floats rather than doubles. Something like this should work.
Code:
Velocity[a] = (new Vector3(
Proximity.X != 0 ?
(float)(Velocity[a].X + (1/(Influence * Proximity.X))) :
Velocity[a].X,
Proximity.Y != 0 ?
(float)(Velocity[a].Y + (1/(Influence * Proximity.Y))) :
Velocity[a].Y,
Proximity.Z != 0 ?
(float)(Velocity[a].Z + (1/(Influence * Proximity.Z))) :
Velocity[a].Z
));
|
__________________
|