I have defined the following record:
type Ball =
{
center : Vector3<m>
radius : float32<m>
color : Microsoft.Xna.Framework.Color
}
I’m trying to create a list of Ball this way:
let BallRadius = 0.2<m>
let list =
[ for i in 0 .. 9 ->
{
center = { X = BallRadius + (float i) * BallRadius * 2.0 ; Y = 0.0<m>; Z = 0.0<m>}; //1 error
radius = BallRadius; //1 error
color = Microsoft.Xna.Framework.Color.White
}
]
Seems that in the first case i is an int and I can’t multiply if for float. In the second case I can’t assign a float to a float32.
How can I solve this?
center = BallRadius + (float i) * BallRadius * 2.0radius = (float32 BallRadius) * 1.0f<m>works, though I’m not sure it’s the most idiomatic.That aside, it’s not clear to me how adding two
BallRadiusgets you aVector3<m>, unless your vector is just a float…