Simulating a trajectory including collisions

Chipmunk2D Bindings for the Unity3D engine
Post Reply
ehudros
Posts: 17
Joined: Fri Oct 12, 2007 8:59 pm
Contact:

Simulating a trajectory including collisions

Post by ehudros »

Hi everyone,
I'm looking for a way to simulate (and afterwards render) a shot trajectory that takes collisions into account. Imagine the trajectory arcs shown in Peggle or pool games - you see how the shot is going to behave and interact with the world around it. This is relatively straightforward in an environment where you can create a clone of your physics world and step it X times every frame (or whenever you need to). However, I've yet to find a way to do something like this with the native box2d implementation of Unity - it's so encapsulated you can't even create you own world object, much less step it on your own. Is there any way Chipmunk 2d can help me if I choose it as my physics library for Unity?

Thanks! :)
User avatar
slembcke
Site Admin
Posts: 4164
Joined: Tue Aug 14, 2007 7:13 pm
Contact:

Re: Simulating a trajectory including collisions

Post by slembcke »

Not in a practical way no. The Unity way is to encapsulate things very heavily into components that can't be used outside of the scene graph. Raycasts would be a much simpler solution if you can get away with point sized projectiles.

It *is* possible if you want to poke around at the PInvoke, but this might end up being a huge amount of work.
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
ehudros
Posts: 17
Joined: Fri Oct 12, 2007 8:59 pm
Contact:

Re: Simulating a trajectory including collisions

Post by ehudros »

Raycasting is a poor choice in my case I'm afraid. Theoretically, would it have been possible to expose the step and Chipmunk world object for developers to use as they see fit? I understand that that's not very "Unity like", but the way I see it the more power developers have the better.
User avatar
slembcke
Site Admin
Posts: 4164
Joined: Tue Aug 14, 2007 7:13 pm
Contact:

Re: Simulating a trajectory including collisions

Post by slembcke »

Well that's what I meant with the PInvoke comment. Technically almost all of Chipmunk is exposed at the C API level. It's not easy to use though. You are basically writing C style code in C# and then adding a bunch of extra code to deal with crossing the language barrier.
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests