Jump to content

retrieve Vec3 of a sandbox model


NivorbiaN
 Share

Recommended Posts

I placed a model (node_spawns_spawn01.gmf) in a map.sbx and named it in the editor "spawn_a01"

 

what I want to happen is when I press the "r" key, that the controller is being moved to the object i named "spawn_a01"

 

so i type:

 

 

if (KeyHit(KEY_R))

{

TVec3 spawnpos; //Create a TVec3 position to store the model position

EntityPosition(spawn_a01, &spawnpos); //Get position of model and store it in spawnpos.

PositionEntity(g_player01, spawnpos, 1); //Position the controller at the spawn model

}

 

logic tells that spawn_a01 needs to be defined, otherwise I get a "error C2065: 'spawn_a01' : undeclared identifier"

 

but when i define it as follows

 

TEntity spawn_a01;

 

i get the following compiler error ": error C2664: 'EntityPosition' : cannot convert parameter 2 from 'TVec3 *' to 'int'"

 

probably i am thinking wrong in how I should approach this.

 

please someone put me on the right track.

"Hmm, don't have time to play with myself." ~Duke Nuke'm

Link to comment
Share on other sites

scene = LoadScene( ... );
TModel spawn_a01 = FindChild( scene, "spawn_a01" );

...

while( ... )
{
...

   if (KeyHit(KEY_R))
   {
       PositionEntity(g_player01, EntityPosition(spawn_a01), 1); //Position the controller at the spawn model
   }
}

Ryzen 9 RX 6800M ■ 16GB XF8 Windows 11 ■
Ultra ■ LE 2.53DWS 5.6  Reaper ■ C/C++ C# ■ Fortran 2008 ■ Story ■
■ Homepage: https://canardia.com ■

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...