Resource icon

[Open Assets] sloperollangle: Character Rotation on Slopes

This content may be freely modified and/or maintained by anyone.
Just discovered this. The camera rolling is pretty legit. I was really into Distance a couple years ago, and this reminds me of Distance a lot.

May I ask for a console command to blunt the strength of the camera roll, for third person? I love the effect, but it's a bit strong for me.
 
There should be a command to add a 22.5 or 45 degree rotation mode for more larger sprites
Or people who liked the 8 degree rotation in the classic games
 
Code:
[10:56 PM] Jimita: NOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
[10:58 PM] Tatsuru: Do you wanna play god? Is that what you want?
[11:04 PM] Kitoko: golden this is illegal
The name is pretty self-explanatory. This Lua rotates the sprites of players against the angle of the slope they're on. Note that this only rotates characters using the roll angle; this doesn't require new sprites.

View attachment 13308

This is also 100% compatible with multiplayer!

View attachment 12809

Download today!

Commands:
Code:
cameraroll <on/off>: Whether the camera rolling feature is enabled or not.
(Exclusive to 2.2.2 and above). Default OFF.

cam_rollspeed <decimal>: How quickly the camera fully rolls to the slope you stand on. Default 0.1.
Good job! My only complaint is that with models, when you look at the front of them, they are wonky, and when looking to the side, they slant.
 

Attachments

  • Screenshot_20210320-000734_Sonic Robo Blast 2.jpg
    Screenshot_20210320-000734_Sonic Robo Blast 2.jpg
    4 MB · Views: 351
  • Screenshot_20210320-000634_Sonic Robo Blast 2.jpg
    Screenshot_20210320-000634_Sonic Robo Blast 2.jpg
    4.1 MB · Views: 379
The problem is, use strafe mode or standard and that's it if you walk on a slope facing forwards going left it should work
 
Code:
[10:56 PM] Jimita: NOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
[10:58 PM] Tatsuru: Do you wanna play god? Is that what you want?
[11:04 PM] Kitoko: golden this is illegal
The name is pretty self-explanatory. This Lua rotates the sprites of players against the angle of the slope they're on. Note that this only rotates characters using the roll angle; this doesn't require new sprites.

View attachment 13308

This is also 100% compatible with multiplayer!

View attachment 12809

Download today!

Commands:
Code:
cameraroll <on/off>: Whether the camera rolling feature is enabled or not.
(Exclusive to 2.2.2 and above). Default OFF.

cam_rollspeed <decimal>: How quickly the camera fully rolls to the slope you stand on. Default 0.1.
Pog
 
Good job! My only complaint is that with models, when you look at the front of them, they are wonky, and when looking to the side, they slant.
Replying to this almost a year later, but if you go into the .LUA and change line 38 from
local lookAngle = R_PointToAngle(mo.x, mo.y) // Get the angle that we're looking from.
to
local lookAngle = mo.angle
it fixes it for models. Breaks it for Sprites, though. So, you know. You can only have one or the other. That said, it only rotates the model left and right, no forward and backward rotation. This is due to how models function on top of how this script functions. There will be no fixing this.

Now, you're rotated when your model is looking perpendicular to the slopes direction:
srb20042.png


But you're straight up when looking directly at the slope:
srb20043.png


Still looks really cool while in motion in game.
 
  • Cool!
Reactions: Peu
Replying to this almost a year later, but if you go into the .LUA and change line 38 from
local lookAngle = R_PointToAngle(mo.x, mo.y) // Get the angle that we're looking from.
to
local lookAngle = mo.angle
it fixes it for models. Breaks it for Sprites, though. So, you know. You can only have one or the other. That said, it only rotates the model left and right, no forward and backward rotation. This is due to how models function on top of how this script functions. There will be no fixing this.

Now, you're rotated when your model is looking perpendicular to the slopes direction:
View attachment 61121

But you're straight up when looking directly at the slope:
View attachment 61122

Still looks really cool while in motion in game.
I'm know almost nothing on coding, but... in the line 38, maybe could use an if or switch. the function gr_models is used for turning the models on or off.
So... if we use something like:
if gr_models == 0 then local lookAngle = R_PointToAngle(mo.x, mo.y) // Get the angle that we're looking from. else local lookAngle = mo.angle end

I say something like that because it does not work... maybe i should put a return... idk. But I think that the "gr_models" is the thing needed, to turn it on and off, and then use the right piece of code in both.

Now what the thing is missing to know how to turn the models in the Z axis. (make them to "look" up and e "down") in the slopes and then we're good to go.
 
I'm know almost nothing on coding, but... in the line 38, maybe could use an if or switch. the function gr_models is used for turning the models on or off.
So... if we use something like:
if gr_models == 0 then local lookAngle = R_PointToAngle(mo.x, mo.y) // Get the angle that we're looking from. else local lookAngle = mo.angle end

I say something like that because it does not work... maybe i should put a return... idk. But I think that the "gr_models" is the thing needed, to turn it on and off, and then use the right piece of code in both.

Now what the thing is missing to know how to turn the models in the Z axis. (make them to "look" up and e "down") in the slopes and then we're good to go.
I know why it doesn't work. Because you've put in if gr_models == 0 instead of if CV_FindVar("gr_models").value == 0. This would work because gr_models is a console variable, not a global one, therefore, you have to use CV_FindVar.
 
  • Cool!
Reactions: Peu
I know why it doesn't work. Because you've put in if gr_models == 0 instead of if CV_FindVar("gr_models").value == 0. This would work because gr_models is a console variable, not a global one, therefore, you have to use CV_FindVar.
Ow... there is that difference? So when you use a console variavel has to be that function. hmm... That's why I said I know almost nothing. Interesting. I will test that. And thats how we learn! Thanks! ^^
 
So, it's been a while and i've looked at some of the posts here have shown me that the problem that's with the rotation on models isn't the X or Y axis, its the Z axis, it would be lovely if someone would make an adjustment or tutorial for that, but for the time being it looks like ill have to find a way myself. if anybody is willing to help then PLEASE do
 
Replying to this almost a year later, but if you go into the .LUA and change line 38 from
local lookAngle = R_PointToAngle(mo.x, mo.y) // Get the angle that we're looking from.
to
local lookAngle = mo.angle
it fixes it for models. Breaks it for Sprites, though. So, you know. You can only have one or the other. That said, it only rotates the model left and right, no forward and backward rotation. This is due to how models function on top of how this script functions. There will be no fixing this.

Now, you're rotated when your model is looking perpendicular to the slopes direction:
View attachment 61121

But you're straight up when looking directly at the slope:
View attachment 61122

Still looks really cool while in motion in game.
srb20000.png

Didn't work for me...
 

Who is viewing this thread (Total: 1, Members: 0, Guests: 1)

Back
Top