SA-MP Forums Archive
[Plugin] cimulator - collision detection and physics simulation - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Plugin Development (https://sampforum.blast.hk/forumdisplay.php?fid=18)
+--- Thread: [Plugin] cimulator - collision detection and physics simulation (/showthread.php?tid=594910)

Pages: 1 2 3 4


Re: cimulator - collision detection and physics simulation - codectile - 04.01.2016

Have look at the CNatives.h source code you might find some useful information.


Re: cimulator - collision detection and physics simulation - Stanford - 06.01.2016

So basically whenever you create a dynamic collision and it finished using physics (CR_ACTIVE = 0) it's automatically being deleted by plugin?


Re: cimulator - collision detection and physics simulation - Crayder - 06.01.2016

Quote:
Originally Posted by Stanford
Посмотреть сообщение
So basically whenever you create a dynamic collision and it finished using physics (CR_ACTIVE = 0) it's automatically being deleted by plugin?
No, it's not removed, it's deactivated. Before I suggested adding a reactivating function the object was made pointless after it was deactivated.


Re: cimulator - collision detection and physics simulation - Stanford - 06.01.2016

Yes, that should be implemented!


Re: cimulator - collision detection and physics simulation - Crayder - 06.01.2016

Quote:
Originally Posted by Stanford
Посмотреть сообщение
Yes, that should be implemented!
My point was that it has been implemented.


Re: cimulator - collision detection and physics simulation - codectile - 06.01.2016

Let me explain you all the basic working principle of bullet physics, especially the activation and the deactivation part. If you throw an object with a certain velocity it will move few units and will stop after some time. When the object is at rest it is deactivated by the engine to reduce the cpu usage by reducing the number of collision checks on each object. Now the question arises, "Will the deactivated object still interact?", the answer is yes. If you throw another object on the deactivated object, physics will trigger again on the two objects. As soon as the AABBs of the two objects overlap the deactivated object gets activated again as it gets added in the collision check list within the engine.


Re: cimulator - collision detection and physics simulation - Stanford - 06.01.2016

So still for example if I don't want it to be a collision anymore I should do a timer to check on objects that have collision but they are not active and remove their collision (if I don't want the interaction anymore)

And what's the difference between CR_IsMoving and CR_IsActive? I mean if the object is moving its supposed to be an active one no?


Re: cimulator - collision detection and physics simulation - codectile - 07.01.2016

Timers should work fine there.

...and CR_IsMoving returns true if the object has a non zero velocity whereas CR_Active checks whether the object is active or not. If an object is inactive you cannot set it's linear and angular velocities and other dynamics related stuff. Note: An inactive object will get activated for a few milliseconds if another (active)object, by passes it in such a way that their AABBs intersect each other.


Re: cimulator - collision detection and physics simulation - Stanford - 07.01.2016

Thanks for your amazing support I hope that you will keep up the good work..


Re: cimulator - collision detection and physics simulation - tungki - 07.01.2016

codectile how u do that


Respuesta: Re: cimulator - collision detection and physics simulation - ipsBruno - 30.03.2016

Quote:
Originally Posted by codectile
Посмотреть сообщение
@ipsBruno, I am currently working on a big update, which will include some demos of vehicle collisions and few other.

Here is a basic demo, Basic Demo. I made it in a hurry so it's not well documented but for a scripter it is easy to understand by just looking at the functions.
Yea, i see it.

Other question:
Quote:
Originally Posted by ipsBruno
Посмотреть сообщение
ColAndreas or Cimulator have any function to return all collisions points of an object?


With this, i can convert object data collision to polygan, and implement a awesome pathfind based this

Thank you


Re: cimulator - collision detection and physics simulation - codectile - 30.03.2016

The picture you posted, is valid only for 2D polygons which is only fit for 2D pathfinding. In our case, everything is in 3D and a single model contains various sub collision shapes such as rectangles, spheres, mesh, etc. Most of the models contains spheres as sub collision shapes, now tell me does sphere has vertices? The answer is no. Your NPC will get confused when a spherical object/model is placed in front of him.


Respuesta: Re: cimulator - collision detection and physics simulation - ipsBruno - 30.03.2016

Quote:
Originally Posted by codectile
Посмотреть сообщение
The picture you posted, is valid only for 2D polygons which is only fit for 2D pathfinding. In our case, everything is in 3D and a single model contains various sub collision shapes such as rectangles, spheres, mesh, etc. Most of the models contains spheres as sub collision shapes, now tell me does sphere has vertices? The answer is no. Your NPC will get confused when a spherical object/model is placed in front of him.
But Cimulator have any method to check all x,y,z collisions in object?


Re: Respuesta: Re: cimulator - collision detection and physics simulation - Crayder - 30.03.2016

Quote:
Originally Posted by ipsBruno
Посмотреть сообщение
But Cimulator have any method to check all x,y,z collisions in object?
The general path finding algorithms work with 3D. You just have to link all of the points which is the hard part.


Respuesta: Re: Respuesta: Re: cimulator - collision detection and physics simulation - ipsBruno - 30.03.2016

Quote:
Originally Posted by Crayder
Посмотреть сообщение
The general path finding algorithms work with 3D. You just have to link all of the points which is the hard part.
Thank you.

I posted it, because a need fastest way to map all collisions arround map, and linked the nodes points.


Re: Respuesta: Re: Respuesta: Re: cimulator - collision detection and physics simulation - Crayder - 30.03.2016

Quote:
Originally Posted by ipsBruno
Посмотреть сообщение
Thank you.

I posted it, because a need fastest way to map all collisions arround map, and linked the nodes points.
[ame]http://www.youtube.com/watch?v=XsP87BkBemw[/ame]

That's what we need to generate. No, Bullet can't generate the nodes and connections for us.


Re: cimulator - collision detection and physics simulation - Finn - 30.03.2016

Amazing to see what kind of things can be done in SA-MP, this makes those pool mini-games look too simple. With this you can make the pool balls jump off the table and continue playing on the floor! lol

Amazing work!


Re: cimulator - collision detection and physics simulation - codectile - 03.04.2016

cimulator-1.07 has been released.

Update Notes:

- renamed RayTrace funtions to RayCast
- now users has an ability to set their own data(integer/float) to their collision volumes
- now CR_CreateStaticCol and CR_CreateDynamicCol returns the collision index, so now you don't have to set an index for you collision volumes manually
- added an inertia parameter in CR_CreateDynamicCol which by default set to 0
- added data related natives CR_SetStaticData, CR_SetDynamicData, CR_GetStaticInt, CR_GetDynamicInt, CR_GetStaticFloat and CR_GetDynamicFloat
- added natives CR_RayCastIntData and CR_RayCastFloatData, which passes the required data(set by the user) by reference
- added pool related natives, CR_GetStaticPool and CR_GetDynamicPool
- renamed "IndexAvailable" functions to "SlotUsed", short and simple
- removed CR_StaticContactTest, use CR_ContactTestEx instead
- removed unnecessary functions
- minor fixes

For a detailed documentation on natives, consult cimulator.inc.

One more thing, I'll be updating and adding demos a bit later.

EDIT:

cimulator-1.09 has been released.

Update Notes:

- Fixed an issue where destroying vehicle collision crashes the server
- added few natives, view the changes here

...and thanks to Crayder for suggesting me to use the AABB method instead of Bounding Sphere method in "CR_PlaceObjectOnGround"


Re: cimulator - collision detection and physics simulation - Pottus - 03.05.2016

I really like all the work on this plugin and wish I had more time to develop on these ideas. It's really nice to see that all the work we put in to make ColAndreas went on to new concepts as well. This plugin brings SA-MP to the next level.


Re: cimulator - collision detection and physics simulation - AIped - 03.05.2016

would be great if there is something about this in the sa-mp wiki like colandreas did.

Quote:
Originally Posted by Pottus
Посмотреть сообщение
I really like all the work on this plugin and wish I had more time to develop on these ideas. It's really nice to see that all the work we put in to make ColAndreas went on to new concepts as well. This plugin brings SA-MP to the next level.
Hell yea!