Transferring physics bodies to new worlds

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
User avatar
VideroBoy
Party member
Posts: 102
Joined: Wed Mar 31, 2010 6:12 pm
Location: Canada

Transferring physics bodies to new worlds

Post by VideroBoy »

Say I have a physics world representing the current level. I want to delete this world and create a new one to represent the next level. The next level has different dimensions and other properties that I can't change in the current world, so I have to create a new world. The player character has its own physics body.

Is it possible to transfer a physics body from its original world to a new world without destroying and recreating it, like for transferring the player character's body to the new level world?

Also, it's now Thanksgiving here in Canada. So...Happy Thanksgiving.
User avatar
ivan
Party member
Posts: 1911
Joined: Fri Mar 07, 2008 1:39 pm
Contact:

Re: Transferring physics bodies to new worlds

Post by ivan »

Happy Thanksgiving. :)
VideroBoy wrote:Is it possible to transfer a physics body from its original world to a new world without destroying and recreating it, like for transferring the player character's body to the new level world?
No. You have to manually recreate the body along with all of its associated shapes (perhaps along with its former linear and angular velocities too). As long as the body you are transferring has no joints attached to it shouldn't be too dificult.
Post Reply

Who is online

Users browsing this forum: No registered users and 182 guests