• (Dumb Question) Add gravity during manipulating move hook?
    2 replies, posted
Hey. This is a really dumb question. I'm manipulating a move hook, so that the player is locked going their sprint speed in a forward direction. I know how to do this, but when I actually do it, what happens is that there seems to be no gravity. Is there some special way to get this to work? Or do I just have to manipulate the movedata to scale the velocity to the player's gravity? Thanks.
"Dumb question"[QUOTE]Or do I just have to manipulate the movedata to scale the velocity to the player's gravity?[/QUOTE] But doctor, wouldn't that cause a parabolic destabilization of the fission singularity? I came in here expecting a dumb question that was within my ability to understand let alone answer.
[QUOTE=ScottyWired;50744773]"Dumb question" But doctor, wouldn't that cause a parabolic destabilization of the fission singularity? I came in here expecting a dumb question that was within my ability to understand let alone answer.[/QUOTE] what i mean by that was that would i have to change the movedata passed in by the move function (here is the docs on the movedata type: [url]https://wiki.garrysmod.com/page/Category:CMoveData[/url]), to scale (scale means multiply a vector, aka if you multiply (1,1,1) by 2 you "scale" it by twice as much) the vector that holds the player's velocity (that is speed of an object in a given direction hence why it's a vector), with the number of the player's gravity. i realize now after typing it out that i explained it wrong, what i should have said was do i need to add the player's gravity vector to the velocity also, if this is correct, how do i get the player's gravity vector? player:GetGravity() returns a number (the gravity multiplier), rather than a vector of how gravity should work on the player i wasn't trying to make myself sound smart. [editline]20th July 2016[/editline] I finally got it after a ton of trial of error. For anyone that may get stuck here too: When you return at the end of the hook, the default behavior is what determines gravity. What I did for my case was to save the z value, and then revert it to 0. Do the calculations, and then set the velocity's z back to normal by assigning it to a vector like vel = Vector(vel.x, vel.y, savedVelocityZ), and then in the move hook do movedata:SetVelocity(vel)
Sorry, you need to Log In to post a reply to this thread.