cassius Posted October 12, 2012 Share Posted October 12, 2012 The following anim which is supposed to run once only sometimes works ok and sometimes fails to happen, with the character immobile but still standing. I have a c version and a bmax version. Another problem is I need to to make the controller lay still on the ground after the character has "died" but it slides along in some random direction. I solved this second problem in Bmax version with FreeEntity controller but when I do the same in c the program crashes.The code is almost identical in both. The first problem is the most important. Does anyone have any anim code better than mine?Thanks. void kill_badguy() { Animate(badguy.model,badguy.k_framebegin,1.0f,true) ; badguy.k_framebegin = badguy.k_framebegin + 0.5f * AppSpeed() ; if (badguy.k_framebegin >= badguy.k_frameend ) { badguy.alive = false; } } Quote amd quad core 4 ghz / geforce 660 ti 2gb / win 10 Blender,gimp,silo2,ac3d,,audacity,Hexagon / using c++ Link to comment Share on other sites More sharing options...
Daimour Posted October 14, 2012 Share Posted October 14, 2012 1. You need to call Animate() every frame. Do you call kill_badguy() every frame? 2. Do you reset value of badguy.k_framebegin for every new bad guy? Quote Link to comment Share on other sites More sharing options...
cassius Posted October 14, 2012 Author Share Posted October 14, 2012 I got the animation working now. The only problem left is the second one How to stop "dead" character sliding along floor. FreeEntity crashes program in c but not in Bmax. I have set the flag badguy.alive to true until the character "dies" when badguy.alive becomes false. Quote amd quad core 4 ghz / geforce 660 ti 2gb / win 10 Blender,gimp,silo2,ac3d,,audacity,Hexagon / using c++ Link to comment Share on other sites More sharing options...
Daimour Posted October 15, 2012 Share Posted October 15, 2012 1. If you want to disappear dead body it's good approach to FreeEntity(). If it crashes you are doing something wrong. Remember C has no garbage collector so you need to manage carefully all references and pointers. 2. If want just to stop sliding body without disappearing it depends of causes that make it sliding. If it slides because of physics forces you'll need probably reduce that forces and/or increase friction. If it slides because of error in your character controller moving algorithm you need to fix it. 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.