I want to have a cube where on tapping the up arrow, the cube rolls forwards and stays put in the new position it rolled to (will then add other directions later). I figured the best way to do this would be to have an action made of the roll because then I could adapt the animation to any style of movement (jump, lumber etc).
But how do I go about making the simple action work with movement? Until now I’ve only played with basic physics engine dynamics in the games engine, not actions. I thought they would play nicer than they do.
Currently, I am adding two actuators; one for the roll animation, and another movement which was to be a full step, though the actuators seem to be interfering with each other.
Thanks for your reply MarcoIT. Yes, the bad end keyframe is visibly corrected by moving frame 11 to 10.01. Thanks.
There’s still a major flaw in my workflow though. Even with the keyframe fix, if you tap UP arrow rapidly, the animation kicks in at odd times and the cube is soon moving diagonally uphill. Also, with the simple motion Actuator moving the cube slightly forward, it does not end up being exactly 2 Blender Units to the next square. In a large playing field (e.g. a chessboard) the cube would eventually be stepping on half squares.
If I had only the simple motion actuator, set as Y=-2, then the cube shunts to the correct position. This is without the roll though, so not what I want.
I’m thinking that my problem could be solved if the animation were truly read as local coordinates. Currently it seems to be global which means without the second actuator it always restarts the cube from the same place.
I’d have a go at using python, but not sure how to call the action animation from a script… but can’t this be done with logic blocks?
I figure that if I don’t want to have the cube sloping uphill, then parent/child or use of an armature rig can be used to ensure the base itself is never actually rotated. The base moves but only staying “flat”, whereas this has a child bone to which the cube is attached, and this second bone is what controls the rotation.
I’ve had a play with them and will need to study them a bit more. Not afraid of Python (I’ve passed certain programming courses in Python) though where Blender calls things like executing actions is a bit foreign so it’s valuable to have your examples. Thanks.
Still studying your solution, though I’ll mark the thread as closed as I think you’ve nailed it.
It was a pleasure and I learned a lot from it myself. I made some more improvements though. Each roll the Cube’s rotation was reset to the initial pose. So texturing the Cube’s faces with different images was out of the picture.
I modified some Actions to be able to combine them with the Add option in the Action Actuators. Still some miniscule shifting during gameplay occurred due to the Add function. So I fixed this with rounding the position and orientation of the Actor on every Axis. I think this result is better than the previous one:
That’s very cool. I’d tried utilising the Add feature but with the methods I was using before it always reset as though everything was absolute global. Another one to examine.
Not off topic. I’d had a game something like that in mind but because I couldn’t remember anything specific about it other than that it was a platform game with a rolling cube I decided not to mention it because it would turn the thread into “guess my game” rather than problem solving. I was trying to find where the game was on my hard drive because I thought having a peek inside would give a clue but my file search came out blank. I think it may have been a finalist in a games making competition where only logic blocks were allowed… like I say my memory of it was a bit vague. It was toon-shader style and may have been an early version of what’s in your video.