Clackdor Posted October 10, 2011 Share Posted October 10, 2011 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? Quote Link to comment Share on other sites More sharing options...
Canardia Posted October 10, 2011 Share Posted October 10, 2011 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. Quote ■ Ryzen 9 ■ RX 6800M ■ 16GB ■ XF8 ■ Windows 11 ■ ■ Ultra ■ LE 2.5 ■ 3DWS 5.6 ■ Reaper ■ C/C++ ■ C# ■ Fortran 2008 ■ Story ■ ■ Homepage: https://canardia.com ■ Link to comment Share on other sites More sharing options...
Clackdor Posted October 10, 2011 Author Share Posted October 10, 2011 That's my question. Which of the above code is more optimal? I guess using "better" is kinda unclear. Quote Link to comment Share on other sites More sharing options...
Pixel Perfect Posted October 10, 2011 Share Posted October 10, 2011 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. Quote 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 More sharing options...
Naughty Alien Posted October 10, 2011 Share Posted October 10, 2011 ..create container for bones, store their data during loading time only and later simply just use stored bone instances to do whatever you want without any use of any hierarchy search functions such as FindChild.. Quote Link to comment Share on other sites More sharing options...
Clackdor Posted October 10, 2011 Author Share Posted October 10, 2011 Thanks! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.