Ledge Hanging

Posted By: Tman

Ledge Hanging - 03/04/10 16:28

Hey guys,

Got another question for you, I see alot of topics with ledge hang is there a script somewhere that I could download and take a look at how it goes or does someone have any code to share that is understandable?
Posted By: Helghast

Re: Ledge Hanging - 03/04/10 16:31

I dont have a script for that, but I do have a theory on this.

You take a point in front of the player, and do a constant trace down that, you check if it's a big enough gap downwards (by checking the distance the hit result returns), and you set the player to the ledge.
You can set the ledge by something like a path along it, and move it over/along that.

hope it gives you a good idea.

regards,
Posted By: Tman

Re: Ledge Hanging - 03/04/10 18:32

Thanks for the quick reply, could you give me like a code snippet of the constant trace down and checking for the gap? If I am not mistaken what you are saying is to do a c trace and do it on the x axis? If that make sense to you?
Posted By: Tman

Re: Ledge Hanging - 03/05/10 15:40

Having a little trouble with this one, because I would like my player to detect all edges or ledges and grab them I have the animation just trying to wrap my head around grabbing the ledges and just detecting anyone has an idea?
Posted By: Tman

Re: Ledge Hanging - 03/08/10 16:44

Still needing some help in understanding.
I have another theory based on what Helghast said and I need some help on trying to get this done.I want to do a c_trace to a the top vertices on the wall or ledge and have the player grab those points now if that sounds about right could someone give a code example on how to accomplish this?

Thanks
Tman.
Posted By: Superku

Re: Ledge Hanging - 03/08/10 17:23



Code:
(1)
___
   |
   |  <-  player comes close to the wall, a c_trace from his origin detects the wall => (2)
   |
   |

(2)
 c_trace from for examples 64 quants above and in front of the player
  |
 \/
___
   |
   |<-player
   |
   |



If (2) c_trace is successful, the ledge is at target.z and x/y is your player's position or the previous target from c_trace in (1).
Posted By: Tman

Re: Ledge Hanging - 03/11/10 15:18

How do you make the player detect one particular wall. I have the player detecting the walls in front of it and I labled the wall as flag2 in the code but it detects everything, even those without a flag set to it, so how could I set it to detect just the wall that I want it to detect?
Code:
action shimmy_move()
{
	set(my,FLAG2);
	my.CREATOR = me;	
}

function move_ledge()
{
	VECTOR wall_ahead[3];
	while(1)
	{
	  c_scan(my.x,my.pan,vector(360,0,750),SCAN_ENTS | SCAN_FLAG2 | IGNORE_ME);
	  
     vec_set (wall_ahead.x, vector (70, 0, -20)); // play with 70 and -20
     vec_rotate (wall_ahead.x, my.pan);
     vec_add (wall_ahead.x, my.x);
     if (c_trace(my.x,wall_ahead.x,IGNORE_PASSABLE | SCAN_FLAG2 | SCAN_ENTS |USE_POLYGON) > 0)
     draw_point3d(hit.x,vector(50,50,255),100,3);
     if(HIT_TARGET)
     {
     	draw_text("Wall Hit...",10,10,vector(50,50,255));
     }
     
     wait(1);
     
   }
}



Here is the code that I am using to detect the walls in front of me.
Posted By: Superku

Re: Ledge Hanging - 03/11/10 15:22

Why do you use c_scan?
I don't know of "SCAN_FLAG2", I'm not sure if it even exists.

if (c_trace(my.x,wall_ahead.x,IGNORE_PASSABLE | SCAN_TEXTURE |USE_POLYGON) > 0)
draw_point3d(hit.x,vector(50,50,255),100,3);
if(HIT_TARGET && tex_flag2)
{
draw_text("Wall Hit...",10,10,vector(50,50,255));
}
Posted By: Tman

Re: Ledge Hanging - 03/11/10 15:37

I was scanning for the particular flag, I got that idea from the lite-c tuts.
Posted By: Superku

Re: Ledge Hanging - 03/11/10 16:29

Have you tried my code?
Posted By: Tman

Re: Ledge Hanging - 03/11/10 16:50

Yes I did and it may be something that I am doing but the tex_flag2 how do you set that up? Do you call the texture flag2?
Posted By: Tman

Re: Ledge Hanging - 03/11/10 19:19

Got it fixed now, it detects the correct wall or ledge and now I am going to having him just hanging around.

Thanks
SuperKu.


Code:
action shimmy_move()
{
	my.skill100= 1502;
		
}

function move_ledge()
{
	VECTOR wall_ahead[3];
	while(1)
	{
	  
     vec_set (wall_ahead.x, vector (15, 0, -20)); // play with 70 and -20
     vec_rotate (wall_ahead.x, my.pan);
     vec_add (wall_ahead.x, my.x);
     result = (c_trace(my.x,wall_ahead.x,IGNORE_PASSABLE |IGNORE_ME | SCAN_TEXTURE));
     if(result > 0 && you)
     {
     	if(you.skill100 == 1502 && HIT_TARGET)
     	{

     	draw_point3d(hit.x,vector(50,50,255),100,3);
     		draw_text("Wall Hit...",10,10,vector(50,50,255));
     		}
     	}
 
     wait(1);
     
   }
}


Posted By: Superku

Re: Ledge Hanging - 03/11/10 19:28

SCAN_TEXTURE modifies tex_flag2, have a look at the manual.
Posted By: Tman

Re: Ledge Hanging - 03/12/10 14:30

Will do, now another question for the forum I am trying to get him to stick to the wall piece any ideas?
Posted By: vertex

Re: Ledge Hanging - 03/12/10 15:34

http://www.dexsoft-games.com/games/dexon.html

Dexsoft has done this...probably in A6?? Perhaps you could appeal Dexsoft for help...

I would double check the downlaodable resources to see if any of the movement code there has it.
http://au.conitec.net/
Perhaps there is c-script code that can be adapted.

Good luck with it.
Posted By: Tman

Re: Ledge Hanging - 03/12/10 16:31

Thank you for this vertex. Here is my ordeal, I have the player set to whenever he hits the target or the wall it tells me hey I hit the wall now I need it to stick to the wall until I tell it to release the wall what is the best way to get it to go about sticking to the wall? I didn't see anything on the resources about it.

Thanks
Tman.
Posted By: Tman

Re: Ledge Hanging - 03/12/10 20:12

Does anyone know of a way to clamp the player in the x position to an object?
Posted By: Tman

Re: Ledge Hanging - 03/15/10 14:21

Almost got just need to get it to stay on the ledge right now what I am doing is saying when I hit the target the postion of the wall is my current position, he sticks for awhile but then just releases, anyone has an idea why that happens?
Posted By: Tman

Re: Ledge Hanging - 03/18/10 18:07

So no one know's how to solve this issue?
Posted By: Tman

Re: Ledge Hanging - 03/21/10 00:14

Got it solved, I think. I have the player colliding and connecting to the platform, thanks for those who help me.
© 2024 lite-C Forums