Walking on walls / climbing
I am making a game where you play as a dragon and I want the dragon to be able to grab onto or crawl along and around cliffs and boulders.
In more detail, when you touch a cliff or cave roof or some such object I want it to latch on and them be able to crawl around until you take off again.
Any ideas how I would do this?
here is a video of the dragon game, this video is a bit old now, the flying is much better now and the landscape is more interesting but this gives you an idea: https://www.youtube.com/watch?v=Y7-5sjX3YiU
Interesting, so is there not a setting on the navigation mesh which controls whats the steepest slopes can be? because if you set that to its highest (probably 89 degrees) and rotated the ladders to just below that angle (lets say 88 degrees) then I would think it would be fine, (although beer in mind the NPCs themselves would probably need to have their max slope angle or whatever its called set to as high as it goes too so they can get up, that should be in the movement component I expect.
If that doesn't work what about. doing a check, if their target is un reachable, is it higher or lower than them, if higher go to the bottom of the up ladder (this would have to be set using a variable I expect, maybe by checking through all the objects of class base of ladder and seeing which is the nearest one which is reachable. Once it reaches the ladder base blueprint it could then go into climbing mode which would simply interpolate its position from the base of the ladder to the top, once at the top the character could do the same check to see if it needs to continue up or down or is on the right level. inevitably this would cause a whole load of flaws, like NPCs going up and down the same ladder if the height of their target was in between the two, and that sort of thing but on the whole I think that would do the job.
By the way I am an artist rather than a programmer so I don't have a clue about the right way to do this stuff, I just do anything I can think of that seems to work!
Woops I set this as an answer, I guess it is an answer, I'm just exploring ideas more than anything though.
Note: This only works by not using the controller rotation but using the actors rotation... the controller expects the character to always be standing up, and since they had to chose an axis to limit because of gimbal lock, if you rotate more than the -90/90 degrees, they flip the roll axis, which completely changes the rotation values, and causes the visible flip. I don't quite understand why this was done, since the engine uses quaternions internally which work around this issue...
To answer the flipping issue. If you are using a character blueprint type, you need to turn off "use controller yaw, roll, pitch" then your character won't flip out when you rotate him past 90 degrees on the pitch axis.
If you need to use controller input (instead of handling input in the character itself) then what you do is turn off "use controller xyz" then after you've rotated past 90°, you need to rotate the controller 180° on the roll axis seperately to compensate for the flip, THEN you turn it back on. This way you won't visually see the internal flip of the roll axis UE4 does to work around Euler angles and gimbal lock. This should also correctly orient your left/right input again.
Follow this question
Once you sign in you will be able to subscribe for any updates here