Chipmunk Physics - referring back to types?

BlitzMax Forums/BlitzMax Programming/Chipmunk Physics - referring back to types?

AdsAdamJ(Posted 2007) [#1]
Hi there, the BlitzMax wrapper for the Chipmunk physics is pretty damn awesome and I'm liking it a lot, I have one issue though.

In my game I have type called Titem which contains a field for the items' body & shape. However, I will need for the shape or body to refer back to Titem so it can update it when they collide with other objects.

For example, when two objects collide they will need to take damage, the 'damage' field being in Titem.

How can I set this up? Am I missing something fundamental?


Brucey(Posted 2007) [#2]
Have uploaded a new version (1.03) which adds support for storing user data in both CPBody and CPShape.

Method SetData(data:Object)
Method GetData:Object()

Note that neither CPBody nor CPShape hold onto a reference to the object themselves, which shouldn't be an problem as you are likely to keep them in your own lists anyway.

:o)


AdsAdamJ(Posted 2007) [#3]
Awesome, thanks for the speedy update. :)


xlsior(Posted 2007) [#4]
Note that this update can be found at: http://code.google.com/p/maxmods/


Space_guy(Posted 2007) [#5]
Thats great!
Thanks alot!


nino(Posted 2007) [#6]
What I do is just extend CPBody to make my base game object class but I will have a look at these Data methods.