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


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Script Help Entity's Location / Distance to Entity
Apjjm Offline
Is easy to say

Posts: 496
Threads: 18
Joined: Apr 2011
Reputation: 52
#6
RE: Entity's Location / Distance to Entity

Yeah, amnesia scripting doesn't expose positions, as I'm assuming frictional didn't think such behaviour would be needed (also, it probably simplified saving the state of the game, as only stuff using SetLocalVar/SetGlobalVar is saved - rather than saving the state of classes etc in the script).

You are correct that my approach is using attached spheres to the origin of props, the callback code just attaches one sphere and creates a collision callback on that sphere. The distance code uses binary (or linear) search over the range of sphere sizes to find the first distance at which the range spheres and the target prop intersect.


With regards to the reload - amnesia can do that if you add the entities to the folder whilst it is running. It probably caches a mapping from file names -> file paths so that no file paths need to be specified in scripting, but that cache wasn't updated (i'm guessing it's probably constructed when the resources file is loaded).


Don't worry about putting me in the credits, but if you want to include me it's entirely up to you how you mention me Smile.

Edit 2:
I think it is just that the "In Range" message is a little deceptive. The range message is displaying the name of the child entity, rather than the parent entity. Try the following:

void cbTestRange(string &in asParent, string &in asChild, int alState)
{
    AddDebugMessage("In Range: "  + asParent + " (" + alState + ")",false);
}
(This post was last modified: 09-04-2012, 04:54 PM by Apjjm.)
09-04-2012, 04:44 PM
Find


Messages In This Thread
RE: Entity's Location / Distance to Entity - by Apjjm - 09-04-2012, 04:44 PM



Users browsing this thread: 5 Guest(s)