johnroper100 / CrowdMaster

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

URGENT: Object location #4

Closed johnroper100 closed 8 years ago

johnroper100 commented 8 years ago

So, currently the agent generation in https://github.com/johnroper100/CrowdMaster/blob/master/cm_agent_generation/generation.py works, but it gives each object in the group a different location. I tried to fix this by putting the location outside of the objects loop:

newLoc = (random.uniform(locationVector[0], scene.randomPositionMaxX), random.uniform(locationVector[1], scene.randomPositionMaxY), ground.location.z)
for o in group_objects:

but this still does not work.

johnroper100 commented 8 years ago

I think this problem may be that with single bone armatures, the parent acts like a parent in that the child mesh is moved to location but then the armature is moved and offsets the child. I am testing.

johnroper100 commented 8 years ago

No, this still does not work even with a full character rig.

johnroper100 commented 8 years ago

@Peter-Noble can you take a look at this?

Peter-Noble commented 8 years ago

I'm not really sure what the error is? What is the point of having the base agent as a group and not just a single object? When I try adding two objects to a group and use that group I get a copy of of each object at various locations with both set to the same position (regardless of the original offset). The objects I used where armatures created using the Rigify addon. (However, if I parent an object to another then add that to the group it places the parented object in completely the wrong place.)

johnroper100 commented 8 years ago

That is the error. I want to be able to create many agents in random locations.

johnroper100 commented 8 years ago

This is only an error when there are parented objects in the group

Peter-Noble commented 8 years ago

I see. I'm still not entirely sure I see the point of using groups for the base agent. Is the generator meant to treat each object in the group as a different agent in order to give variety to the crowd or are all the objects in the group meant to be part of the same agent?

johnroper100 commented 8 years ago

All part of the same agent, for meshes with an armature and multiple parts. I have been testing on the victor rig from BlenderCloud

johnroper100 commented 8 years ago

@aditiapratama this is the big issue now

johnroper100 commented 8 years ago

I am going to try to set the parent after the location is set

johnroper100 commented 8 years ago

@TheDuckCow the child objects still are not showing up

TheDuckCow commented 8 years ago

@johnroper100 okay I'll take another look when I can. Do they not show up in the outliner at all?

edit: just had the thought that if anything has a parent, the only difference should be that they just don't have an assigned location/rotation as it should inherent from the root. So in the code we looked at, perhaps we sectioned off too much in the else clause.

johnroper100 commented 8 years ago

the children do not, I will take a look at your idea

johnroper100 commented 8 years ago

Seems to be working for now. If the problem returns I will reopen the issue.

johnroper100 commented 8 years ago

@TheDuckCow This is an error with multiple objects on an armature as well. Take a look at test-error.zip.

johnroper100 commented 8 years ago

ThThis needs to be fixed before anything else happens.

johnroper100 commented 8 years ago

@TheDuckCow @Peter-Noble So, I found the problem, the meshes are duplicated, but the armature modifier still is set on Armature when it should be set on Armature.001 for agent 1 for example.

Peter-Noble commented 8 years ago

Is that something we can adjust after then duplication or should we be using a different method of duplicating them?

johnroper100 commented 8 years ago

I just need to know how to update the armature modifier on each object with the new armature

johnroper100 commented 8 years ago

I fixed it!