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 Get entity velocity?
palistov Offline
Posting Freak

Posts: 1,208
Threads: 67
Joined: Mar 2011
Reputation: 57
#8
RE: Get entity velocity?

There's a little trick you could try, but it requires debugging and testing work on your end. What we're going to do is create a "dummy" entity to place over or in front of the real entity and the player will actually break the dummy. Open the model editor and import the mesh under static_objects > castlebase > floor > "deafault.dae" (yes that's how it's spelled in my Amnesia for some reason. The reason I'm choosing this mesh is that it's thin and is one-sided, so you can flip it over or any way you like to make it harder for the player to spot.

Select the mesh. Make its size 0.01 for X, Y and Z. Create a shape that matches the kind of object you want to actually break in-game. (e.g. If it is a door, make the body shaped like a door. This is what I mean by debugging and testing. You'll need to turn on Physics Debug in-game and make sure the body size of this custom entity we're making matches the object you want to break. Create a body from that shape and assign it a material type. Go to User-Defined Variables (under the Settings drop-down menu). Change the object type to Object > Static. Scroll down and check the BreakActive box.

Now place this object into the level. If you have trouble clicking on it (because the actual mesh is so small) press ctrl + F and search for the name of the entity then click on it.

Orient it, etc etc. In your script file you can then script this:

PHP Code: (Select All)
void OnStart()
{
    
SetEntityCallbackFunc("dummy_ent""BREAKFUNC");
}
void BREAKFUNC(string &in entitystring &in type)
{
    if(
type == "Break") { /*break the real entity here!!!*/ }


When the dummy entity is broken, you can run whatever scripts you want, even if it doesn't involve breaking something. This is just a clever way of "testing" the speed of an object when it hits another by whether or not the latter breaks. This requires a bit of testing some time commitment, especially seeing as I've never tried this, but this is just a solution that came to mind to your problem. And that's the price we have to pay as developers if we want to bring fresh and fun content to players Tongue

(This post was last modified: 10-27-2011, 10:00 PM by palistov.)
10-27-2011, 09:56 PM
Find


Messages In This Thread
Get entity velocity? - by Patacorow - 10-25-2011, 08:34 PM
RE: Get entity velocity? - by Apjjm - 10-25-2011, 10:28 PM
RE: Get entity velocity? - by Patacorow - 10-26-2011, 05:47 AM
RE: Get entity velocity? - by Apjjm - 10-26-2011, 11:41 AM
RE: Get entity velocity? - by Patacorow - 10-26-2011, 01:54 PM
RE: Get entity velocity? - by Patacorow - 10-26-2011, 03:56 PM
RE: Get entity velocity? - by Your Computer - 10-26-2011, 08:28 PM
RE: Get entity velocity? - by palistov - 10-27-2011, 09:56 PM
RE: Get entity velocity? - by Patacorow - 10-31-2011, 08:58 PM



Users browsing this thread: 1 Guest(s)