- Home /
Script assistance ledge hang teleporting/Added video.
Here's the scenerio: My character has an empty parented to him(above his head and a little in front of him) which I'm trying to use for him to teleport to in his climbup function. His ledge hang works fine and he does indeed teleport as I intended except the character is teleporting relative to the empty's position to the parent, instead of it's own world position.
function Climbup() {
player_pos.transform.position = ledgeteleport.transform.position;
Invoke( "Climbingup", .3 );
player.animation[climbup.name].speed = 3;
player.animation.Play(climbup.name);
}
function Climbingup(){
ledged = false;
player.GetComponent ("kuro_mouselook").enabled = true;
player.GetComponent ("kuro_movement2").enabled = true;
player.GetComponent ("push_stuffscript").enabled = true;
player.GetComponent ("PlayerAtk").enabled = true;
audio.PlayOneShot(jumpSound, 1);
}
I've tried many variations of transform.localPosition, transform.position, transform.TransformPoint(0, 0, 0), ect.
I know I'm working along the right lines, but this has been giving me fit's for about a week now, and I thought it was time to let someone else take a crack at it.
Thanks to those who take the time to assist.
Edit:
Ok so here's the video where I'm trying to debug my ledge climb. You'll notice when my character jumps his ray that shoots from an empty parented to his main character and the ray moves while in mid jump causing him to grab the ledge at wrong spots and when my character teleports his main transform to another empty parented to him he ends up going through the geometry.
As he changes I toggle the ledge detector on and off as well as his movement script, yet when you press the climb key he seem to keep his velocity and shoots forward as well.
Any help would be aprecciated.
If embed link doesn't show here's the link to the video: here
Answer by whydoidoit · Jul 04, 2012 at 06:22 AM
Well
player_pos.transform.position = ledgeteleport.transform.position;
Will move the player to the location of the ledgeteleport object.
That's what I originally was using, and you're correct it does work part of the time, and sometimes my character teleports through the floor when I do it. and sometimes he teleports into the walls box collider.
$$anonymous$$aybe the bug is somewhere else then, like when my character is in his hang state, or he's colliding with something.
Thanks for taking a look at it for me $$anonymous$$ike.:)
I'll keep trying. This method worked really well in blender, I wish there was a good 3rd person ledgehang tutorial to exa$$anonymous$$e.
Added video link in first post.
Ok so here's the video where I'm trying to debug my ledge climb. You'll notice when my character jumps his ray that shoots from an empty parented to his main character and the ray moves while in mid jump causing him to grab the ledge at wrong spots and when my character teleports his main transform to another empty parented to him he ends up going through the geometry.
As he changes I toggle the ledge detector on and off as well as his movement script, yet when you press the climb key he seem to keep his velocity and shoots forward as well.
Any help would be aprecciated.
Your answer
Follow this Question
Related Questions
Teleport enemy after player collides with an object? 0 Answers
Player Prefs saving position Script assistance. 2 Answers
how to add a sound to this script 3 Answers
Issue with my Teleport Script 1 Answer