Jump to content

Variables and Entities


Clackdor
 Share

Recommended Posts

So, I'm playing around with player animation and I have what I think is a style question, but could possibly be more. When accessing bones in a model, would it be better to create a variable to store the bone and then access the variable:

 

Load {
TEntity headbone = FindChild (mesh,"Bip01 Head");
}

Run {
Animate (frame,headbone,0,0):
}

 

OR Just use the FindChild function all the time.

 

Run {
Animate(frame, FindChild(mesh,"Bip01 Head"),0,0);
}

 

OR is it simply a style question and my graphics rendering will dominate resource cost?

Link to comment
Share on other sites

Speed is always a problem in games, and you can never make a game how you would want, but must reduce assets complexity and code. So I would go always with the simple rule that make things optimal when you can.

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

Access to a simple variable ( a pointer in this case) is always going to involve less overhead than running a Leadwerks function. It wouldn't matter either way if it was a single call, but if its repeated then I'd go with the variable every time.

Intel Core i5 2.66 GHz, Asus P7P55D, 8Gb DDR3 RAM, GTX460 1Gb DDR5, Windows 7 (x64), LE Editor, GMax, 3DWS, UU3D Pro, Texture Maker Pro, Shader Map Pro. Development language: C/C++

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...