Ambiera ForumDiscussions, Help and Support. |
|
|
|||||
|
In-game animation works when I change from All to Jump - but when I try to change animation from Jump to Attack (using the set animation of animated scene node action), the model just disappears instead of switching to the attack animation. The animations frames are set-up properly (as far as I can tell) and all the animations work fine individually in the editor. How do I switch animations without the model disappearing please? Thanks! |
||||
|
Check animation blending, and check looping and uncheck it. Cause i never encountered such problem there might be something wrong with the switching between animation. There might be chances that the animation switching is done at once for all animations and looping is off. Make sure there is no empty extra animation frames in your animation. Sometimes there are few empty frames in some animation and when looping is turned off model simply doesn't show up cause it is stuck to the last frame or first frame of the animation (empty frames) so try setting the animation to looping and check if it still disappears. Hope that will help😇 |
||||
|
Thanks for the help! I finally figured out what was going wrong - it's because the model is set as a "game character". When I switch to an animation, it's being overridden to the default animations by the characters A.I. I don't think there's a fix for this problem. Same thing happens with my main character (controlled by keyboard); I can't manually switch the animations - they can only be switched automatically between Stand/Walk/Die/Attack - depending on what the character is doing at the time. As a dirty workaround, I cloned the characters several times and assigned a single animation to each clone. I child' all these clones to a parent "Dummy", so I can then switch between the cloned models to give the illusion of changing animations. The main drawbacks using this workaround are: 1- using multiple models is more complex to work with (and presumably uses more resources). 2- Animation blending doesn't work across multiple models so there is a hard cut when switching models. |
||||
|
or you can simply use the action change animation of an animated model or you can also use the ccbAIcommand() Api to stop the current action and then play the animation and do the next AI command using the same ccbAIcommand() javascript api then there will be no need to use multiple models and I beleive it will also fix the animation blending issues. just give it a try! Best of luck! |
||||
|
Hey Thanks just_in_case! If you could help, that would be great. It's the change animation action that's giving me the problems. Multiple models was the only fix I could find so far. Can you explain how to use the change animation action or the API properly please? It's not working for me. Maybe I'm doing something wrong but if (for example) I change an animation to "attack".... ...if the game character is walking, it will play the "walk" animation instead of the "attack" animation I tried to switch to. How do I override the "walk" animation and change it to "attack", even if the player is walking. Thank you, really appreciate the help. |
||||
|
That's pretty easy and self explanatory All you have to use ccbAicommand(cancel) and ccbAicommand( move to) along with some random position values as additional arguments. You can check the documentation to understand it more clearly. Due to lack of time I can't explain it more here. But whenever I get time I will reply to this thread relative to the ccbAicommand topic. Meanwhile just go through the documentation. |
||||
|
Thanks, I had a look at the docs for ccbAicommand(cancel) - it doesn't really explain how to use it properly or give an example. I tried using the following script to cancel the Wasp's Ai.... var w = ccbGetSceneNodeFromName("Wasp"); ccbAicommand(w, cancel); but it just throws an error... "Reference CopperbubeAi not defined." |
||||
|
You didn't capitalize the "I" in "AI", nor did you capitalize the C... var w = ccbGetSceneNodeFromName("Wasp"); ccbAICommand(w, "cancel"); I wouldn't even waste your time using the AI behavior. It's crap and useless for anything. |
||||
|
yup @j9907 is right, Also you need to make sure that your object must have the Ai behavior attached to it. and am totally agree with @j9907 that CopperCube's current AI is really bad but even if you are going to create your own one you need to do scripting for that as well. |
||||
|
could this have anything to do with this animation blending thing I see here? sorry, just speculating... https://www.ambiera.com/coppercube/doc/index.html "Animation Blending Since version 5, CopperCube blends animations when switching between them. This feature is automatically enabled, but can be turned off or adjusted for every animated model manually in the editor or via script. This also means that you don't need to create perfect animation loops. The engine will automatically blend non-fitting animation loops together so that they look nice. Uncheck the box 'AnimationBlending' in the Property Window when your animated mesh is selected, to disable this feature. To disable this feature using JavaScript, do it like that: var s = ccbGetSceneNodeFromName("yourModel"); ccbSetSceneNodeProperty(s, "AnimationBlending", false); You can also change the animation blending time in the same way, use the property 'BlendTimeMs' for this then." has the OP tried to disable this? I am not sure why AI is making a mesh disappear as I have not run into that just yet, |
||||
|
j9907 wrote: You didn't capitalize the "I" in "AI", nor did you capitalize the C... var w = ccbGetSceneNodeFromName("Wasp"); ccbAICommand(w, "cancel"); I wouldn't even waste your time using the AI behavior. It's crap and useless for anything. Thank You! That's probably why it's not working. Well spotted! Only reason I'm using AI at the moment is because I can't code yet and the game is basic enough that the built in AI kinda does what I need for now. Appreciate the help. |
||||
|
Still doesn't work - I think it's a bug with the moveAI_to_position extension. It seems to screw everything up - the AI, restarting a scene and switching scenes. Really frustrating. |
||||
|
why is your fps at 250 in that image you provided when all niko's default characters are at 30? edit: perhaps that extension needs fps to work? I don't have the js for that one so I can't tell. |
||||
|
wrote: why is your fps at 250 in that image you provided when all niko's default characters are at 30? edit: perhaps that extension needs fps to work? I don't have the js for that one so I can't tell. Tanks! I got the character from sketchfab and used Mixamo to rig and animate it, then used Ultimate Unwrap Pro to convert it to Direct X format. The actual FPS is around 30 for the individual character animations I made. The 250FPS seen in the image is for "ALL" animations together, which isn't used in my game. Yeah, I would say it's probably a bug in that specific script rather than an FPS issue. I'm not sure where I got the script - just a link from searching through the forum discussions. I've used it for a long time with no problems but this last 6 months almost everything I do seems to be extremely buggy. I even started again from scratch and even tried reverting back to v6.3. |
|