overte-org / overte

Overte open source virtual worlds platform.
https://overte.org/
Other
128 stars 47 forks source link

collisionWithEntity event is broken.. maybe. #956

Open SilverfishVR opened 1 month ago

SilverfishVR commented 1 month ago

It seems that now, for the event to trigger the entity has to have collision enabled and be dynamic.

This was not always the case,collisionWithEntity has been used extensively before for interactivity in VR, like attaching entities to the fingertips of avatars so they can push buttons etc.

This doesn't really work if both entities have to have collision and be dynamic. For one, entities parented to avatars seems to never collide and if the target entity is dynamic, it can be moved by a collision which is generally not what you want for a button or something like that.

A few examples of scripts that definitely used to work but no longer do: https://github.com/overte-org/overte-content/tree/master/Marketplace/Piano https://github.com/overte-org/overte-content/tree/master/Marketplace/primitive-painting https://github.com/overte-org/overte-content/tree/master/Marketplace/xylophone

I have a theory, in the past, even static entities without collision would trigger physics calculations and/or send the collision signal. This was evident by the fact that clipping through lots of geometry would slow down game rate significantly. This no longer seems to be the case, which is a good thing.. mostly. But being able to detect collisions between objects without having them move around is very useful for interaction. Maybe a new system needs to be implemented.

So how would you create this kind of interaction now? The one way I can think of is:

  1. find the UUID of all the entities of interest.
  2. get their bounding box or otherwise estimate the outside surface position.
  3. continually poll the distance between the objects.
  4. if the distance is less than object A bounding/2 + Object B bounding/2 (assuming all cows are spherical), trigger a "collision"

Not a good solution in my opinion, You could also add a physics action or script to the entities to stop them from moving but again, a lot of workaround for something that really should be a very basic interaction.

I am not sure when this changed, current release of Overte has it but it could have happened long before that

daleglass commented 1 month ago

Dev meeting: possibly broken before V8