Having a problem with collisions when am rotating a group

Hi,

I can’t get my collision to fire if the object is in a group and the group is rotating.

Take the object out the group and the collisions start working.

To get the group to rotate am using -

Group.x = 180
Group.xReference = -180

Then in a runTime event as setting Group.rotation = Group.rotation + 1

I have set physics to hybrid and the object that is rotating is a physics object and is not asleep.

Any ideas ?

Dave [import]uid: 117617 topic_id: 27059 reply_id: 327059[/import]

Hey.

There is a well known isue with collisions and groups whereby you need to have all objects involved in the collision in the same group.

For instance. Lets say you have a group for player, (group1) which contains all of the graphics/particle effects/layers/whatever for your hero.

You also have a group for every enemy in the scene, (group2)

To get the collisions going, you must add both group 1 & 2 to a mastergroup, (call it what you like).

Hope that helps?

Dan [import]uid: 67933 topic_id: 27059 reply_id: 109853[/import]

That doesn’t seem to have helped.

I have 3 groups -

Main group
Enemies Group
Bullets Group

The Enemies Group is rotating.

Both Enemies and Bullets are in Main.

If I add a object to Main, a bullet fires the collide event (when it hits the object).

If I add a object to Enemies, a bullet just goes straight through the object.

The collision event is attached to the bullets.

EDIT: Got a feeling it’s something to do with setting Group.xReference on the Enemies group. As am printing “event.other.name” and every now and again a enemy name is printing, although the bullet is passing right through them.

Dave [import]uid: 117617 topic_id: 27059 reply_id: 109872[/import]

At first, make sure that you don’t manually move enemies or bullet groups. Any changes you want to make, you should apply to main group only.
Physics world is not an exact representation of the screen, and putting objects in different group can mislead us to think that they should collide while in reality in physics world they are separated.

For example:
Let’s say we have a bullet and enemy, neither of them still not inserted in any grouop, both at position x,y = 150, 150.
If we add them to physics, they will obviously collide.
Now lets add each of them to their own group ( Bullets and Enemies groups).

Now if we move bullets group for example:
Bullets.x = Bullets.x + 300
Our bullet and enemy will look quite separated on screen but in physics world they will still collide, because their x,y values are still 150,150.

When you use debug mode, do the debug rigid bodies that should collide actually collide visually on screen, or their position is all over the place?
Also, when in debug mode, are debug objects rotating with the main group or they are in place (they shouldn’t rotate in debug mode)

Please note, that when you rotate the group that rigid bodies belong to, only their visual representation is rotated, but not their physics body. Therefore if you set debugMode to “hybrid” you will see that debug rigid bodies are not in the same place as their visual representation.
[import]uid: 80100 topic_id: 27059 reply_id: 109888[/import]

Thanks nosheet, think you have explained why it’s not working.

In debug mode everything rotates and looks as they should.

If I print the x and y of the objects in the rotation group, they dont change, I presume that is because they are not moving the group is.

So am presuming the physics engine is looking at them X and Y numbers and as my bullets never hit them numbers, no collision takes place.

If I set physics to Hybrid the objects in the rotation group look like physics objects, hence I thought it would all work.

Basically I don’t think it’s possible to do what I want to do, rotating the groups.

This looks interesting http://developer.anscamobile.com/code/move-object-through-path think I might forget rotating the groups for rotation and use something like this.

Dave
[import]uid: 117617 topic_id: 27059 reply_id: 109918[/import]