Need enemy transpose obstacle with animation

I need help idea for enemy transpose box with animation.Need made animation over box? use collide to start animation and with applyforce? enemy have dynamics physics.

you want the enemy to choreograph an animation? you want enemy to move like climbing?
i’ve made tests with this and it’s complicated. it depends on what you want to do and you need python and LOTS OF MATH in all cases.
first would be something called “killsync”, you use a ray to detect when the enemy is close to the player, and then you have to move the enemy to a position relative to the player position:

enemy.worldPosition = [player.worldPosition[0], player.worldPosition[1]+1.0, player.worldPosition[2]]

you might want to take player.orientation into account when calculating the player rather than being aligned with he world coordinates.
then you start the player and enemy animation at the same time from the same script.

then there’s a climbing animation, there a multiple ways of doing this, all complicated.
you can animate both the box and the armature and make it look like it’s moving at the same time, by animating the climb, then animating the box, then shiftting the climb animation to move in place and synchronize with the box, then use the action actuator and check “add” or the other option so that the animation moves the box.
the other method is the one i used, wich is to animate the armature, then move the box to the final position when the animation ends. this fails because bge lacks precise frame animation, animation finishes before or after logic depending on framerate, making it look bad.

for other things like hanging off a cliff you would need to disable physics and control the characters yourself through logic and timers.
if you tell what you want to do in a bit more detail, it would be easier to help you.

its transpose cube obstacle not a player.I need check distance form enemy to cube then start animation but need applyForce or applyinpulse for enemy change location and transpose.My problem is what axis to apply this.the physics is dynamic

please go to google translator, write in the language you use, and post the translation here. i can’t undestand what you are saying.

import bge
cont = bge.logic.getCurrentController()
obj = cont.onwer
scene = bge.logic.getCurrentScene()
objList = sceneObjects
#the name of your box, or you can get this from radar, near or other sensor (hitobject or hitobjectList[0])
box = objList.get("box")
def move():
      pos = enemy.getDistanceTo(box)
      if pos < 0.5:
            enemy.applyMovement([0.0, 1.0, 0.0] ,True)
            vect = enemy.getVectTo(box)
            enemy.alignAxisTo(vect[1], 1, 0.5)
           #your animation


what do you mean? you would normaly use the Y axis and set local to True, but you can do that with logic, what you are asking doesn’t seem too complex. please explain in more detail.

My enemy have a box.armature parented to box and mesh parent to armature.i need create a sensor distance of enemy box to BOX obstacle to activate your script.transpose Z axis may be cause box have a height
Ok thanks will try your script

I made some adjustments in your script follows 3 images and

without any errors on the console your script does nothing.

If you can help

Thank you

look using Module zombie_transpose.move with always sensor and nothing on image 3

I correct this line on script
vect = enemy.getVectTo(box)
vect = enemy.getVectTo(BoxTranspose)
now enemy up to box but dont move forward this is cause i use pathfollowing(navmesh)? need edit my pathfollowing(navmesh) for enemy can walk forward in up BoxTranspose?

Yout script Worked editing my navmesh creating new up face index solved but now zombie walk lost the navmesh and not follow me more look Image 4 on up BoxTranspose

my bad, it should’ve been if pos > 0.5: since it has to move when it’s far and stop when it reaches.
if you are using a navmesh, you can do:

point = [ moveX, moveY, 0.0] #or the worldPosition of your box
elsiguiente = navmesh.findPath(obj.worldPosition, point)
vectTo = obj.getVectTo(elsiguiente[1])
rotacion = vectTo[1]
obj.alignAxisToVect(rotacion, 1, 0.5)
obj.alignAxisToVect([0.0,0.0,1.0], 2, 1.0)
obj.applyMovement([0.0, obj["speed"], 0.0], True)

The enemy can continue following player.the enemy stop with crazy rotation in up of BoxTranspose
look picture

how solve that? I dont use your second script cause dont know about “speed” prop ?

in this i dont use nothing about your first script?

friend look the enemy stay there up the BoxTranspose only can i create a property for use in transpose animation for move to ground position in both sides? understand?

I try your second script and not work just zombie up walk in top of BoxTranspose when have a face of my navmesh i got a point red in visualize is a red line but zombie rotate crazy with both scripts and cant back to ground for continue follow player
May be i activating Obstacle Simulations RVO will help?

i’m giving you examples, you need to give the enemy an AI, you need to set states, or a property to control the actions. when the enemy reaches the target, you need to change to a different state, make it do something else, change animation, set a new target.
if pos > 0.5: means that the enemy will move as long as it’s away from the target. ‘0.5’ is the distance at wich it must stop. you can put an elif with a different condition and make it do something else when it’s close to the target, like attacking the player, playing the stand animation, or changing to a different state to execute a different script.
take a look at the bge python API to see all the functions you can use. if you are new to bge, watch one of the hundreds of bge tutorials in all languages in youtube or other pages to learn the basics. you can ask for help if you don’t know how to use one, but i won’t write an entire AI for your game and post it here, that would be silly. it’s YOUR game, not mine.
anyways, good luck.

I know about states and my game are in advance progress but when you post your first script i forget ask about RVO the enemy and BoxTranspose need work like obstacles with navmesh or our script not work correctly beleive.

RVO is not good with steering horrible kill dynamic movements of zombie go work with states and sensors for try get a good effect transpose box.Have 2 sides then player position is very important for zombie work in both sides

I used player.worldPosition.y to move sensor.worldPosition.y to other side then when zombie collide with sensor sendMessage to change state transpose where execute action animation transpose.There have a frame property when finish action animation transpose go to state walk(state play all time walk animation).this is a easy method and with great performance