So I have created a scenario where you touch an enemy, and the enemy should teleport you, and I used the motion actuator, but instead of taking me to the coordinates I typed in, it took me that amount of distance away from when I teleported. How should I go about doing this?

use python. using the motion brick does teleport you but now in that way.

collsion sensor -> python.

then set the worldPosition of the collision.hitObject

I am new to the blender game engine, I previously only did 3D animation so I know absolutely nothing about Python, I’m not even sure I know how I would start it. :grin:

on enemy or the object, put a collision sensor -> python (module not script)
then add this to a script give it a and use name.test

now adjust the position in the script and it should work

def test(cont):

    collision       = cont.sensors['Collsion']

    if collsion.positive:
       collision.hitObject.worldPosition = [0,0,0] #coords of the position (x,y,z)

Well it closes the game now every time I hit the enemy
Here is my setup (currently in the character)

So you know what going wrong here?
Do exactly what i said :wink:

Okay, do I paste the script into here? How does the module work?

inthere you put… scriptname.test

so name the script…
put in the brick teleport.test

Okay I still did not bet it to work. Also thank you for working through this with me.
Here is my current set up:

Where did I go wrong?

you did not connect the collison sensor with the python module abd the D you can unselect (unless you’re not using the ingame editor)

Still doesn’t work, what else could I have done wrong? :thinking:

oops my bad, made 2 typo’s

use this:

def test(cont):

    collision       = cont.sensors['Collision']

    if collision.positive:
       collision.hitObject.worldPosition = [0,0,0] #coords of the position (x,y,z)

That still didn’t seem to work, so here is what I am going to try (tomorrow, it’s late here):
Create an animation where there is one key frame and that keyframe is where I want the spawn point to be. So when you hit the bad guy, it will play the animation, which will teleport you to the location.

Thank you again for your help!

script works

see it works.blend (515.0 KB)
(w to move)

I know this is going to sound annoying, but when I hit the block, it doesn’t do anything. Could it be some strange issue on my end?

what physics type does the player have?

edit, you mean my blend don’t works either?

Yeah your blend didn’t work either. In my game I am using character physics

ah maybe that’s the problem

edit, nope tested it with character physics it still works

What should it be?