Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support collidable moving parts #2493

Merged
merged 9 commits into from Oct 29, 2013
Merged

Conversation

Luomu
Copy link
Member

@Luomu Luomu commented Oct 14, 2013

About damn time, if I may say so.

From a modeller's point of view, you just name a piece of animated geometry "collision_d_whatever" (d for dynamic) and it'll be added as collidable instead of visible geometry. I recommend sticking to simple cubes, and only when they are really necessary, like space station doors.

Now, the implementation is a bit hairy... we need to to tie CollisionGeometry nodes (which may have a complex chain of transforms) into the collision system's Geom objects. To achieve this:

  • CollisionVisitor links a GeomTree with a CollisionGeometry node (GeomTrees are libColliders triangle data, and shared)
  • when ModelBody creates Geoms, it matches them with CollisionGeometries using the CollisionGeometry-GeomTree link (Geoms are per-body objects, and have a transform)
  • before moving Geoms, ModelBody needs to accumulate the animated transform for each CollisionGeometry (implemented as DynCollUpdateVisitor)

Limitations: the way collisions work in Pioneer, moving geoms won't push the linked geoms around. That'd be... physics. Like, if a ship extends an animated landing gear into a surface, it'll just go through, and only collide when the ship moves.

The dynamic collmeshes aren't visible in the modelviewer yet because that's tricky :(

@Luomu
Copy link
Member Author

Luomu commented Oct 14, 2013

For a test case, I've got this...thing. http://paahdin.com/projects/pioneer/multicoll.7z
Replace Wave model with it, toggle landing gear and go fly at some buildings.

@fluffyfreak
Copy link
Contributor

It looks good, a lot cleaner too. Seems like you did a lot of tidying up in implementing it all :)
Didn't get chance to test that's just from reading through the code but I didn't spot anything bad.

Plus you got rid of a filthy global ;)

@Luomu
Copy link
Member Author

Luomu commented Oct 16, 2013

You could test it by adding collision to hoop_stations, all it takes is one box moving in sync with the doors. I can't import the .daes properly into Blender.

@fluffyfreak
Copy link
Contributor

Hopefully this isn't waiting on me having time to test it by learning how to animate a spacestation door? :/

It looks good to go in and then someone will eventually be able to make use of it, and the new idle animations, in their new models or updating existing ones.

@robn
Copy link
Member

robn commented Oct 28, 2013

Nah, I've just been short on time and brain for it. I'm going to read over it and probably merge it tomorrow.

@robn robn merged commit 922f2b7 into pioneerspacesim:master Oct 29, 2013
@robn
Copy link
Member

robn commented Oct 29, 2013

This is great!

It occurs to me that its not a big step from here to being able to damage parts of the ship independently. We just need a separate hit counter per collision geom, right? :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants