Sorry for my ignorance but looking at the documentation I can't find anything like it.
Let me explain: Is it possible to know which entity 'A' collides with if there are 200 entities in the environment?
Something similar to entitycollided= EntityCollide(A,#PB_Any)
Why EntityCollide(A,B) needs to specify who B is.
Thank you!!
Entity collision with another unknown entity is posible?
Entity collision with another unknown entity is posible?
If translation=Error: reply="Sorry, Im Spanish": Endif
-
- Addict
- Posts: 2345
- Joined: Mon Jun 02, 2003 9:16 am
- Location: Germany
- Contact:
Re: Entity collision with another unknown entity is posible?
You can store all entities in a list and iterate through that to check for collision.
bye,
Daniel
Daniel
Re: Entity collision with another unknown entity is posible?
Hi DarkDragon, thanks!, may be a solution.DarkDragon wrote: Fri Jan 05, 2024 9:11 pm You can store all entities in a list and iterate through that to check for collision.
If translation=Error: reply="Sorry, Im Spanish": Endif
Re: Entity collision with another unknown entity is posible?
In purebasic you can count the occuring collisions at any given time. World physics must be enabled, entities must have bodies.Is it possible to know which entity 'A' collides with if there are 200 entities in the environment?
The official examineworldcollisions.pb example might be helpful.
Examineworldcollisions counts the collisions and returns false, when there are no, any other if there is one or more to check.
Using Nextworldcollision() you can iterate trough the list of collisions created with the examine.
First and Secondworldcollisionentity() get the participants of the examined collision.
Code: Select all
If ExamineWorldCollisions(#False) ;False here means, we do not need extra data for the collision, like normals
While NextWorldCollision()
entityA = FirstWorldCollisionEntity() ;These two are colliding in this collision
entityB = SecondWorldCollisionEntity()
Wend
EndIf
When you create a game object for physics in a modeler, or a mesh on the fly: create it centered around origo 0,0,0
If you don't, your simple physics bodies (cylinders) won't be in sync with your entity. Your compound objects will be, but the center of mass will remain at 0,0,0.
( the last can be used to create an all-the-way-up weeble wobble as a feature, since there are no command to set the center of mass, only to get)
Static objects shall be fine. If any given time you have doubts, use:
Code: Select all
WorldDebug(#PB_World_DebugBody)

Re: Entity collision with another unknown entity is posible?
Hi miso, thanks again for your time and help.
Is exactly the answer i was looking!!!
Yes your help is really appreciated!
Master you never say stupid things.
Thanks for help and when finish my game i will send a link to test the game.
Have a happy and nice day!
Is exactly the answer i was looking!!!
PS: I wish you luck with your project, hoping i have helped a bit and did not say too many stupid things...

Yes your help is really appreciated!
Master you never say stupid things.
Thanks for help and when finish my game i will send a link to test the game.
Have a happy and nice day!
If translation=Error: reply="Sorry, Im Spanish": Endif