1. Nothing to report. Been watching the XNA videos and I am in the process of reorganizing my code. I knew I would have to do this and now is the time.

2. Curious about something and I have looked around.

I have the following function that generates a random Vector3. I use it for scaling but it can be used for other things.
Code:
```    public Vector3 RandomVector3(float MinX, float MaxX, float MinY, float MaxY, float MinZ, float MaxZ)
{
float X = Random.Range(MinX, MaxX);
float Y = Random.Range(MinY, MaxY);
float Z = Random.Range(MinZ, MaxZ);

return new Vector3(X, Y, Z);
}```
and I call like
Code:
`transform.localScale = RandomVector3(1f, 5f, 3f, 5f, 2f, 6f);`
Very simple stuff. The question is though I would like float MinY, float MaxY, float MinZ, float MaxZ to be optional and if not there then default to float MinX, float MaxX. I would use this to scale evenly on all axis.

I have been reading up and haven't seen anything clear on this. I haven't got to it in the XNA so if there is a video just point to it.

3. Hey Ben give some thought to just passing in two Vector3's into your RandomVector3() method. One to hold the Min values and the 2nd to hold the Max values. Cheers mate.

4. Thanks that didn't even occur to me. I think it is cleaner. Now I can do just this.
Code:
```        transform.localScale = RandomVector3(new Vector3(1, 2, 4), new Vector3(5, 6, 7));
transform.Rotate(RandomVector3(new Vector3(0, 90, 180), new Vector3(90, 180, 270)), Space.Self);```
to call this
Code:
```    public Vector3 RandomVector3(Vector3 Min, Vector3 Max)
{
float X = Random.Range(Min.x, Max.x);
float Y = Random.Range(Min.y, Max.y);
float Z = Random.Range(Min.z, Max.z);

return new Vector3(X, Y, Z);
}```
To get me random positions and scales.

Another baby step on the long road.
Last edited by benmcl; 02-06-2010 at 04:44 AM.

Page 4 of 4 First ... 234

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•