Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Script Help Get entity speed
Apjjm Offline
Is easy to say

Posts: 496
Threads: 18
Joined: Apr 2011
Reputation: 52
#6
RE: Get entity speed

The only way to, in a general sense, track an object's speed is to track the position of the object at a set interval. Position tracking of objects is a tricky thing - and there are multiple ways to go about it:

  1. Octtree search - This involves having an object hidden off the map to which you attach special block-box entities. You then determine which of the boxes the tracked object is in and subdivide them. You repeatedly do this until you reach the boxes of a small enough resolution, where you can average the coordinates to obtain a reasonable COM for the object. This search has to be done each time you poll the position, and AddAttachedPropToProp is very slow.
  2. Script-area grid - This is like the above approach except you generate (automatically) a huge array of script areas and just add a bunch of collision callbacks. This makes the map editor lag and isn't suitable for large maps.
  3. Trilateration - You need 4 objects placed outside the map. You then attach a bunch of spheres of different radii which let you poll the distance to each of the objects outside the map. Given that you know the distances from your object to the external object, and you know the positions of these objects you can implement trilateration to calculate the position. The downside here is that the maths is tricky!

When you have the position of the object, you can store it and calculate the change in position to get the speed. However, there is a simpler method for the door problem: you can always just set up the toughness & health values on the entities to bypass the whole speed check and let the game handle breaking the door.
(This post was last modified: 02-06-2013, 11:38 PM by Apjjm.)
02-06-2013, 11:36 PM
Find


Messages In This Thread
Get entity speed - by FlawlessHappiness - 02-06-2013, 07:46 PM
RE: Get entity speed - by NaxEla - 02-06-2013, 09:34 PM
RE: Get entity speed - by FlawlessHappiness - 02-06-2013, 09:51 PM
RE: Get entity speed - by Adny - 02-06-2013, 09:57 PM
RE: Get entity speed - by FlawlessHappiness - 02-06-2013, 10:01 PM
RE: Get entity speed - by Apjjm - 02-06-2013, 11:36 PM
RE: Get entity speed - by FlawlessHappiness - 02-07-2013, 12:18 AM
RE: Get entity speed - by Your Computer - 02-07-2013, 12:41 AM
RE: Get entity speed - by FlawlessHappiness - 02-07-2013, 07:53 AM
RE: Get entity speed - by Your Computer - 02-07-2013, 11:01 AM
RE: Get entity speed - by MulleDK19 - 02-08-2013, 05:31 PM
RE: Get entity speed - by FlawlessHappiness - 02-08-2013, 05:43 PM
RE: Get entity speed - by MulleDK19 - 02-08-2013, 07:11 PM
RE: Get entity speed - by FlawlessHappiness - 02-08-2013, 07:33 PM



Users browsing this thread: 1 Guest(s)