How to change how physics / gravity works in garrysmod?

Now this question might sound weird when I explain it, as I barely know how to explain it, here;
I found this work from Z0mb1n3

Its just… a very cool way of rotating, now I have almost figured out how to finish it (I have almost finished remaking its, because it so cool)

Anyway, is there anyway I can make it the jet pack changes how world physics works in garrys mod? So for example; You jetpack up a little bit, then turn the camera angles around like 90 degrees and then when you look down, your feet are touching a wall, how would I make it like gravity has been changed and physics have been rewrote as so the player can walk along the wall like he would along the ground?

Any ideas?


GM:Move hook is your friend.

By simply returning “true” in that hook, it stops all of the regular movement applied to a player. Then, you modify the MoveData and make it do what you want. In this case, you have a wall, you get the normal vector of the wall, and you apply force to the player’s movedata in the opposite direction of the wall normal. Now you have gravity being applied in that direction.

Rotating the view can be done through InputMouseApply. Modify the player’s EyeAngles in relation to the normal of the wall. All default EyeAngle calculations are done assuming up is Vector(0, 0, 1), but make your calculations translate that into whatever the “up” direction of the wall is (the surface normal vector of the wall). The WorldToLocal function will let you translate EyeAngles accordingly.

Btw, remember

Player:SetAllowFullRotation if you want to allow the players model to rotate freely

Thank you so much, this has truly inspired me.
(As it is your work to begin with <3)

[editline]25th July 2017[/editline]

I have a problem, and please mind that I basically have no idea what im doing (as I have never used move or input mouse)


local function Move_Jetpack( ply, mv )

	local speed = 0.0003 * FrameTime()

	local ang = mv:GetMoveAngles()
	local pos = mv:GetOrigin()
	local vel = mv:GetVelocity()

	vel = vel + ang:Forward() * mv:GetForwardSpeed() * speed
	vel = vel + ang:Right() * mv:GetSideSpeed() * speed
	vel = vel + ang:Up() * mv:GetUpSpeed() * speed

	if ( math.abs( mv:GetForwardSpeed() ) + math.abs( mv:GetSideSpeed() ) + math.abs( mv:GetUpSpeed() ) < 0.1 ) then
	vel = vel * 0.90
	vel = vel * 0.99

	pos = pos + vel

	mv:SetVelocity( vel )
	mv:SetOrigin( pos )

	return true

hook.Add( "Move", "Move_Jetpack", Move_Jetpack )

local function InputMouseApply_Jetpack( cmd, x, y, ang ) 
	local x1, y1, z1 = ang
	cmd:SetViewAngles( Angle( x, y, z1 ) ) 
hook.Add( "InputMouseApply", "InputMouseApply_Jetpack", InputMouseApply_Jetpack )

My problem is, when the player presses SPACE they go flying forward?
And my second problem is, inputmouseapply wont modify view angles, it just trips out and places it back to the cursors view?

Any ideas? ^^

What you could do is override the default jump function

That’s in Move.