Product Chat / Player animation to climb a ladder?

Author
Message
Burgos
4
Years of Service
User Offline
Joined: 25th Apr 2020
Location:
Posted: 11th Nov 2020 18:34
My son and me were talking about if could be possible to do an script that could be attached to an ladder to simulate that the character is climbing the ladder.
Our idea is to remove the gravity of the player, or maybe set the Y axis of the player while he is close or in front of the entity. Removing the user controls till the user reach the end of the ladder. At the same time, could be great to play the animation stored in the CGI references.
I coud not found how to manage this. Maybe there is something in the jetpack section.
Does anyone know which function could be usefull for that?
Thanks in advance
PM
3com
10
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 11th Nov 2020 18:49
The handicap I see on player animation is that the player does not have a body, even hands when he is disarmed.
Then I think you would have to model hands an animate then as the player is climbing the ladder.
We usually using tele-transport, but something says to me that this is not what you are looking for.
Laptop: Lenovo - Intel(R) Celeron(R) CPU 1005M @ 1.90GHz

OS: Windows 10 (64) - Ram: 4 gb - Hd: 283 gb - Video card: Intel(R) HD Graphics
cpu mark: 10396.6
2d graphics mark: 947.9
3d graphics mark: 8310.9
memory mark 2584.8
Disk mark: 1146.3
Passmark rating: 3662.4

PM
Bored of the Rings
GameGuru Master
19
Years of Service
User Offline
Joined: 25th Feb 2005
Location: Middle Earth
Posted: 11th Nov 2020 18:50
Search is your friend here. There are several threads about climbing ladders
Professional Programmer: Languages- SAS (Statistical Analysis Software) , C++ VS2019, SQL, PL-SQL, JavaScript, HTML, Three.js, others
Hardware: ULTRA FAST Quad Core Gaming PC Tower WIFI & 16GB 1TB HDD & Win 10 (x64), Geforce GTX1060(3GB). Dell Mixed Reality VR headset, Aerodrums 3D
Burgos
4
Years of Service
User Offline
Joined: 25th Apr 2020
Location:
Posted: 11th Nov 2020 19:47
@3com. You are rigth. We are not looking for a teleport solution.
@Bored of the Rings, Thanks we already checked before. But the solution we found were changing the angle of the ladder or via teleport, but we are looking for a solution in which the player really climb the ladder.
PM
synchromesh
Forum Support
10
Years of Service
User Offline
Joined: 24th Jan 2014
Location:
Posted: 11th Nov 2020 20:23
This was my best effort ..
The only person ever to get all his work done by "Friday" was Robinson Crusoe..
PM
Burgos
4
Years of Service
User Offline
Joined: 25th Apr 2020
Location:
Posted: 11th Nov 2020 20:50
@synchromesh
Looks cool, it is very close to the one we want to create.
PM
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 11th Nov 2020 23:33 Edited at: 11th Nov 2020 23:34
the stock character has plenty of extra animations to use for such things

using
SetFreezePosition(x,y,z)
SetFreezeAngle(ax,ay,az)
TransportToFreezePosition()
is probably the easiest method to manually control the player via script
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
Burgos
4
Years of Service
User Offline
Joined: 25th Apr 2020
Location:
Posted: 12th Nov 2020 00:26
Thanks @smallg, I tried these functions
SetFreezePosition(x,y,z)
TransportToFreezePosition()
But seems like if the player was stacked by gravity. Maybe i didn´t do it correctly.
Regarding you video.....the character recognize the ladder himself? or you programed the script to execute this animation in each zone?

PM
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 12th Nov 2020 00:47
TransportToFreezePosition() has to be called every frame otherwise the physics engine will take over and control the player capsule.
Been there, done that, got all the T-Shirts!
PM
GubbyBlips
5
Years of Service
User Offline
Joined: 14th Jan 2019
Location:
Posted: 12th Nov 2020 03:55
@Burgos
The solutions these guys have given above work just fine. No problems.
It's the recommended technique.
But if you run into issues with it, (you just wanna try something different),
a trick is to make an invisible platform that goes up or down, take a ride on
it, and animate your TP Player as they climb.
>> You gotta script the animation yourself <<

https://forum.game-guru.com/thread/221692
PM
3com
10
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 12th Nov 2020 08:25
I keep myself talking than it needs the Devader's player body and/or some animated arms grabbing the stair handrail, simulating the player going up / down the ladder, to make it look realistic.
And as the icing on the cake, I would grease the ladder and use decals to simulate the player's handprints.
Laptop: Lenovo - Intel(R) Celeron(R) CPU 1005M @ 1.90GHz

OS: Windows 10 (64) - Ram: 4 gb - Hd: 283 gb - Video card: Intel(R) HD Graphics
cpu mark: 10396.6
2d graphics mark: 947.9
3d graphics mark: 8310.9
memory mark 2584.8
Disk mark: 1146.3
Passmark rating: 3662.4

PM
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 12th Nov 2020 09:26
as amen said, need to call the commands every frame they are being updated.
Quote: "Regarding you video.....the character recognize the ladder himself? or you programed the script to execute this animation in each zone?"

yes the character could detect the ladder / windows etc and performed the action needed, not a pre-scripted sequence
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
Burgos
4
Years of Service
User Offline
Joined: 25th Apr 2020
Location:
Posted: 12th Nov 2020 21:25
Quote: "as amen said, need to call the commands every frame they are being updated."


I tried before post the help request. I did something very simple, only I used the
SetFreezePosition(x,y,z)
TransportToFreezePosition()
In the _main function
I did something like this:

But I said seems like if the player was attached to the ground. (the if statement is commented because I tried with and without it. I also tried the active always property to avoid the script stop running when the player is far from the object.
Thats why I asked if there is any way to remove the gravity, I realized that gravityon() off() did not work at all.


PM
Burgos
4
Years of Service
User Offline
Joined: 25th Apr 2020
Location:
Posted: 12th Nov 2020 21:27
Quote: "yes the character could detect the ladder / windows etc and performed the action needed, not a pre-scripted sequence"


As I said is Awesome
PM
GubbyBlips
5
Years of Service
User Offline
Joined: 14th Jan 2019
Location:
Posted: 13th Nov 2020 04:44
Over- redundant question but...
This script is attached to the ladder?

Just sat down and worked out a decent ladder script (at least I think so...!)
Works better than my hidden platform one made some time back.
Enter from top or bottom both work just as well. Change height to suite--
so of course you can customize for each ladder if different heights.
{{Up to you to add animations if 3rd person}}

Test it out;

local ladderactive = {}
local moveup = {}
local playeratx = {}
local playeraty = {}
local ladderheight = {}

function ladder_init(e)
ladderactive[e] = 0
moveup[e] = 0
ladderheight[e] = 300

end -- init

function ladder_main(e)

playeratx[e] = 0
playeraty[e] = 0
if math.abs(g_PlayerPosX - g_Entity[e]['x']) < 25 then
playeratx[e] = 1
if math.abs(g_PlayerPosZ - g_Entity[e]['z']) < 25 then
playeraty[e] = 1
if ladderactive[e] == 0 then
moveup[e] = g_PlayerPosY
ladderactive[e] = 1
end
end
end

if playeratx[e] + playeraty[e] < 2 then ladderactive[e] = 0 end

if ladderactive[e] == 1 then --------- on ladder so activate climb
Prompt("Press 'A,X,D' to exit ladder")
if g_Scancode == 17 then
if moveup[e] < g_Entity[e]['y'] + ladderheight[e] then moveup[e] = moveup[e] + 2 end -- 'W' up
end

if g_Scancode == 31 then
if moveup[e] > g_Entity[e]['y'] + 35 then moveup[e] = moveup[e] - 2 end -- 'S' down
end
if g_Scancode == 45 then ForcePlayer( g_PlayerAngY + 180, 1) end -- 'X' to exit ladder
if g_Scancode == 30 then ForcePlayer( g_PlayerAngY - 90, 1) end -- 'A' left
if g_Scancode == 32 then ForcePlayer( g_PlayerAngY + 90, 1) end -- 'D' right
SetFreezePosition(g_PlayerPosX, moveup[e], g_PlayerPosZ)
TransportToFreezePositionOnly()
end --------- on ladder so activate climb

end -- main
PM
GubbyBlips
5
Years of Service
User Offline
Joined: 14th Jan 2019
Location:
Posted: 13th Nov 2020 04:55
Edit...

... "playeraty[e]"
was meant to signify 'playeratz[e]' -- z coordinate
(if you want to change that!
Didn't effect it's functionality. Been breathing too much
sheet-rock dust today... sorry.

If you want to get more complex, you can also add
if PlayerLookingAt >> ladder
Before it's climbed, but again, not sure that's necessary.
PM
Burgos
4
Years of Service
User Offline
Joined: 25th Apr 2020
Location:
Posted: 13th Nov 2020 16:15
Thanks @GubbyBlips, works perfecttly!

My son wants to have also the hands, so I have a lot of work to do yet. . Bit this is a great start. I need to understand why the functions
SetFreezePosition(X, y,z)
TransportToFreezePositionOnly()
did not work for me at the begining.
Maybe because I sum the value inside the function call. I will need to check.

Again thanks.
PM
bluemeenie195
6
Years of Service
User Offline
Joined: 28th Oct 2018
Location:
Posted: 14th Nov 2020 14:33
Great job GubbyBlips !!
PM
GubbyBlips
5
Years of Service
User Offline
Joined: 14th Jan 2019
Location:
Posted: 14th Nov 2020 17:00
Tilted ladders would be a feature that could be added,
just would have to consider the angle the ladder is placed on
the map, so there would have to be variances in play...
PM
Teabone
Forum Support
18
Years of Service
User Offline
Joined: 8th Jun 2006
Location: Earth
Posted: 14th Nov 2020 18:10
Some old tests:

Player from first person to 3rd person switch:


NPC:


Store Assets - Store Link
Free Assets - Resource Link

i7 -2600 CPU @ 3.40GHz - Windows 7 - 8GB RAM - Nivida GeForce GTX 960
bluemeenie195
6
Years of Service
User Offline
Joined: 28th Oct 2018
Location:
Posted: 15th Nov 2020 15:42
That NPC climbing the ladder looks really good Teabone.
PM
3com
10
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 15th Nov 2020 17:10
@ bluemeenie195
G to your link https://www.youtube.com/watch?v=gXWbVKb7hX8&t=6s, RMB over the video screen a select copy video URL and then you end up with the link below:
https://youtu.be/gXWbVKb7hX8, so you have extract to all being after the last slash (/) in your case: gXWbVKb7hX8, then highlight this link, and apply it the YT tag, and you are done.
Laptop: Lenovo - Intel(R) Celeron(R) CPU 1005M @ 1.90GHz

OS: Windows 10 (64) - Ram: 4 gb - Hd: 283 gb - Video card: Intel(R) HD Graphics
cpu mark: 10396.6
2d graphics mark: 947.9
3d graphics mark: 8310.9
memory mark 2584.8
Disk mark: 1146.3
Passmark rating: 3662.4

PM
bluemeenie195
6
Years of Service
User Offline
Joined: 28th Oct 2018
Location:
Posted: 15th Nov 2020 19:17
PM
bluemeenie195
6
Years of Service
User Offline
Joined: 28th Oct 2018
Location:
Posted: 15th Nov 2020 19:18
Nice,
Thanks 3com
PM
3com
10
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 15th Nov 2020 19:43
Your welcome.
Laptop: Lenovo - Intel(R) Celeron(R) CPU 1005M @ 1.90GHz

OS: Windows 10 (64) - Ram: 4 gb - Hd: 283 gb - Video card: Intel(R) HD Graphics
cpu mark: 10396.6
2d graphics mark: 947.9
3d graphics mark: 8310.9
memory mark 2584.8
Disk mark: 1146.3
Passmark rating: 3662.4

PM
synchromesh
Forum Support
10
Years of Service
User Offline
Joined: 24th Jan 2014
Location:
Posted: 16th Nov 2020 13:02
@GubbyBlips
Amazing Script !!
The only person ever to get all his work done by "Friday" was Robinson Crusoe..
PM
GraPhiX
Forum Support
19
Years of Service
User Offline
Joined: 15th Feb 2005
Playing:
Posted: 20th Nov 2020 20:21
@GubbyBlips

Thank you for the script is it ok if i modify it slightly and add a place holder for it? so that it can be dragged onto items in a level?
My bridge support as a cage around the ladders so i cannot make it active it loses its poly shape if i do and is not climbable.
So i have attached the script to an invisible place holder and dragged it in over my ladder and it works fine
Welcome to the real world!
Main PC - Windows 10 Pro x64 - Core i7-9700K @4.2GHz - 64GB DDR4 RAM - GeForce RTX 2070 SUPER 8GB - 2TB NVe, 1TB NVe, 2TB Hybrid Data Drive
Test PC - Windows 10 Pro x64 - Core i7-7700K @4.2GHz - 32GB DDR4 RAM - GeForce GTX 1060-6G 6GB - 1TB NVe SSD
Laptop - Helios 300 Predator - i7 7700HQ - 32GB - Nvidia GTX1060 6GB - 525GB M2 - 500 SSD - 17.3" IPS LED Panel - Windows 10 Pro x64
Asset Manager
granada
Forum Support
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: United Kingdom
Posted: 20th Nov 2020 20:48
Quote: "So i have attached the script to an invisible place holder and dragged it in over my ladder and it works fine "


Just like hammer, the half-life editor

Dave
Windows 10 Pro 64 bit
GeForce RTX™ 2070 GAMING OC 8G
AMD FX (tm)-9590 Eight-core Processor
31.96 GB RAM
3840 x 2160 ,60 Hz
PM

Login to post a reply

Server time is: 2024-11-23 12:40:16
Your offset time is: 2024-11-23 12:40:16