davechurchill / cwaggle

CWaggle Robot Simulator
MIT License
9 stars 6 forks source link

Polygon body shapes would be nice! #8

Open avardy opened 5 years ago

avardy commented 5 years ago

Actually, any ability to incorporate more complex body geometry would be helpful. This could be adding a triangle component or extending the current CLineBody component so that it could be attached to a robot.

davechurchill commented 5 years ago

Polygonal bodies completely change the entire physics system to be really complex and slow , which is why we wrote cwaggle in the first place! Arbitrary polygon intersections are very expensive computations. This will be a very very long term implementation and I don't expect I'll get to it any time soon

davechurchill commented 5 years ago

You can 'get around' this by hacking together a system that just changes the position of some of your entities with LineBody(s) to follow their position as they move

avardy commented 5 years ago

On polygonal bodies: okay, fair point. On the LineBody idea: not 100% sure what you mean. Something like creating a temporary LineBody (s) at the robot's current position, then immediately removing them? Other idea: multiple CircleBody components per robot, allowing you to approximate other shapes. Is that a bit more doable?

davechurchill commented 5 years ago

The problem is the 'linking' of the multiple bodies together, which completely changes how the physics engine works. Can you give a concrete example of something you need to do?

avardy commented 5 years ago

I want to simulate a non-circular robot with a wedge-shaped plow at the front.

davechurchill commented 5 years ago

That's going to take more work to implement than writing the entire simulator has so far. You can simulate a wedge right now with two linebody entities, if you manually update the position of the lines. However they can currently only interact with things that have circlebodies

avardy commented 5 years ago

Okay, I'll give the linebody wedge a go. It means I will get more realistic collisions between robots and pucks. Collisions between robots will be slightly less realistic (both just circles), but that's okay.

avardy commented 5 years ago

I have a version of the linebody wedge working.. image Currently however I get pucks trapped between the two linebodys and the circlebody of the robot. But I have an idea to fix this.

davechurchill commented 5 years ago

Nice!