Making an object fall down and go back to their original position

I am aiming to make 10 objects appear at a random position, fall down, and go back to finding a random position.

I have gotten the random position and 10 objects down to the T. I just need to make it fall down and loop some how. Any suggestions?

        for i in range(10):
     iceCream = loader.loadModel('phase_4/models/props/icecream.bam')
     iceCream.setPos(-30+random.randrange(100),50,10)
     iceCream.setScale(0.75)
     iceCream.reparentTo(render)

There is a built-in panda physics, which performs more math tasks than simulations. You can also use the physical engine Bullet. You decide what you need, simulation or mathematical model of behavior.

I wouldn’t frame it in quite the same way, I think, but I agree: Do you want a highly detailed simulation, with bouncing and potential stacking, rolling, etc.; do you want the objects to simply fall, hit a surface, and then reset; or do you want the objects to fall for a certain amount of time, without interacting with anything else, and then reset?

In the first case, I recommend Bullet physics.

In the second case, I recommend Panda’s built-in physics. You could use Bullet, but Panda’s system is likely to be easier to work with in this case, I think.

In the third case, I recommend just using a task to update their positions, or perhaps a pos-interval.

(All of the above suggested tools are detailed in the manual.)

2nd case.

By the way, how would I define an actor node? How would I make physics in a model?

Fair enough. You have my answer for that, then! :slight_smile:

What do you mean by “define an actor node”? You had another thread about constructing an Actor, so you know more or less how to do that, and I’m thus not sure of what you’re asking…

That depends on what you mean.

If you’re using Blender, you can define physics shapes there using logic-tags.

However, since you’re also asking about Actors, note that Panda doesn’t allow you to deform collision geometry the way that Actors animate. You can move collision solids, even attach them to the armature of an Actor to approximate an animated collision shape, but not move the vertices around in the same way. (As far as I know, at least.)

All that is useful to you can learn for example:
“ball-in-maze”
“roaming-ralph”
Take a look and learn.