Giving bodies additional properties

Topics: Developer Forum
Oct 9, 2013 at 8:17 PM
So here's the thing, When ever I cut a shape in two, it looses all of the properties I gave it (restitution, friction) sets them to the default, whatever that may be. So I was wondering if there was a way to track a body that has been cut using the CuttingTools.Cut(World) method and somehow get the instances of the bodies that have been returned from the cut.

also I was wondering if there is a way to add certain properties to a body. i.e.; if I wanted a body to disappear after a certain amount of time, how would I go about setting a variable for that specific body and then call that variable to deduct and check if the variable is expired so I can remove the body?
or will I have to do all of that externally? i.e.; create an external list of variables and have each body correspond to a certain variable.
Oct 10, 2013 at 1:28 PM

Although I'm a beginner at Farseer have you looked at using the UserData for bodies... I create an object with properties and then stuff that object into the UserData:-
GameObject obj = new GameObject(int countDown);
Body myBody;
myBody.UserData = obj;

//then to get it back to read or modify the countdown
GameObject objToReadCountDown = (GameObject)mybody.UserData;

//do stuff with the Gameobject
Marked as answer by genbox on 10/10/2013 at 12:49 PM
Oct 10, 2013 at 7:50 PM
As for the CuttingTools.Cut() method, I think the loss of properties got fixed in 3.5. Otherwise you just save the values before the cut, and apply them after.
Oct 12, 2013 at 3:20 AM
Thanks guise ^-^
I always wondered what UserData was, now it just seems self explanatory.