johnroper100 / CrowdMaster

Crowd Simulation for the Masses
http://crowdmaster.org
GNU General Public License v3.0
133 stars 24 forks source link

Random Rotation not working #3

Closed johnroper100 closed 8 years ago

johnroper100 commented 8 years ago

Currently, there is a random rotation value. This does not seem to work for some reason and I have gone through multiple different revisions of code. You can see what I mean if you open the test scene and just press Run Sim. The random rotation and the actions should already be set up. @niewinny @theduckcow Could one of you take a look at this?

johnroper100 commented 8 years ago

https://github.com/johnroper100/CrowdMaster/blob/master/simulation/main.py#L59-L63

randRot = random.uniform(0, scene.randomPositionMaxRot)
eul = mathutils.Euler((0.0, 0.0, 0.0), 'XYZ')
eul.rotate_axis('Z', math.radians(randRot))
johnroper100 commented 8 years ago

See that?

johnroper100 commented 8 years ago

I will tell you when I have moved the code to it's proper place so that work can be done.

johnroper100 commented 8 years ago

The code for the random rotation is https://github.com/johnroper100/CrowdMaster/blob/master/cm_agent_generation/generation.py#L36-L39

randRot = random.uniform(0, scene.randomPositionMaxRot)
eul = mathutils.Euler((0.0, 0.0, 0.0), 'XYZ')
eul.rotate_axis('Z', math.radians(randRot))
scene.update()
Peter-Noble commented 8 years ago

Rotation is being applied now but not very much control over it. It would be nice to have x, y, z offset, min and max rotation.

johnroper100 commented 8 years ago

Ok, that can be done. This was just the first step.