Posts: 181
Threads: 38
Joined: Aug 2010
Reputation:
0
Hello.
I was wondering if anyone got a way to detect collision between 2 objects.
(ex.: Detect when a rocket (an object) hits a wall)
Any ideas are welcomed.
Thanks in advance.
Posts: 637
Threads: 23
Joined: Feb 2013
Reputation:
0
Use colandreas. It is designed for collisions. Look at its name Collision Andreas.
Posts: 760
Threads: 22
Joined: May 2011
Reputation:
0
Because they are silly and didn't actually read what you wrote, instead they took the context of my post and thought it was the main post, for some reason. Anyways I just gave an example and I still hold what I said.
There's no magical function (at least not without a plugin) and only way to get it is through knowing the end coordinates as I repeat again. My example only showed the way to get when an object collides with the ground (Z).
Posts: 2,856
Threads: 6
Joined: Jun 2007
Reputation:
0
Like Hansrutger said, you need to know the end position, everything else would be to computationally intensive in pawn
For example, your rocket, whenever you call MoveObject calculate beforehand the next collision with CA_RayCastLine and adjust the destination
Posts: 1,801
Threads: 21
Joined: Mar 2008
Reputation:
0
What's the path of that rocket?
If it's a non-homing rocket which travels a straight line, just use CA_RayCastLine once and you know the end position.
For more complex paths (eg homing rocket with moving target, like a vehicle) it's almost the same, just that you have to raycast for every change in direction that the rocket does.
CA uses way less resources than you think. A 5000 Node 3D Path can be checked for collisions within a few ms (using raycasting), and I seriously doubt any Rocket will fly that far. If the target is moving it has to check only once every few ms anyway.