The cage

Please don't post Bullet support questions here, use the above forums instead.
Post Reply
User avatar
Tomator
Posts: 9
Joined: Mon Oct 18, 2010 8:53 am

The cage

Post by Tomator »

Hi

Whem I make a simple scene, I will often get my objects fly away, i.e. falling from the floor. A user of my application will make such scenes often. Building walls every time is not he will dream about.

So I would need something that would limit objets movement in space, allowing them do everything they do now as far as they are in the allowed area. Like birds in a cage.

First I wanted to make an constrain but they seem to be limited to have two objects linked. I will need sometging that would get a list of object and take care about them. There may be tens of objects and creating a constrain for each one wouldn't be effective and managing them would be a nightmare.

Then I thought about the world modification, but what if I (or the user) needed more cage areas?

Now I don't know where start from.

Maybe we could add a forece fields to the bullet? As I know there are no such objects. Beside the cage they could act as wind, magnetic field, inter-object gravitation etc.

But the first I need is the cage. How to start doing this?

Best Regards...
Johan Gidlund
Posts: 26
Joined: Mon Jun 01, 2009 2:21 pm
Location: Sweden
Contact:

Re: The cage

Post by Johan Gidlund »

What exactly do you want to happen when objects reach the border of you "cage"?
I think I would have used constraints like you first suggested as long as the area objects are allowed to move inside is easily described mathematically.
The other object in your constraint would in this case be the world since I assume your cage would be fixed.
User avatar
Tomator
Posts: 9
Joined: Mon Oct 18, 2010 8:53 am

Re: The cage

Post by Tomator »

Johan Gidlund wrote:What exactly do you want to happen when objects reach the border of you "cage"?
I think it would be fine to configure. Object could just stop, slide by the limit or bounce.
The shape would by mostly cuboidal, but I can imagine also spherical or cylindrical ones. These are mathematically desribable shapes.

As the starting point let's assume that we will want to have cuboidal cage fixed to the world and when the object reaches the limit with its transformation point, it bounces like there was a wall there. No angular interia modification will be done then, only linear.
Johan Gidlund wrote:I think I would have used constraints like you first suggested as long as the area objects are allowed to move inside is easily described mathematically.
The other object in your constraint would in this case be the world since I assume your cage would be fixed.
Constraints get two objects and I would like to manage a group of tens of objects within one cage. So I'm not sure if constraint concept is suitable.

Maybe the inverted body would be the solution? Inverted body collides with bodies thet tries to leave it, not ones that tries to enter it. This would limit cages number to one per world, but maybe it is the fastest way to get to the point?
User avatar
Tomator
Posts: 9
Joined: Mon Oct 18, 2010 8:53 am

Re: The cage

Post by Tomator »

I've done it. The functionality is pinned to the bullet with pretick callback and works.

However, it could be great if the bulled had interface to add such forcefields to the world. They could be shared then.
Post Reply