-
Notifications
You must be signed in to change notification settings - Fork 71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding rocket jumping to this script #8
Comments
It likely won't work with a rigid body, mostly just because the movement script acts as its own isolated physics. I've never used a rigid body in Unity, I've usually always written my own physics scripts so I am not sure how helpful I can be. What happens when you call the knockback function? Does it just not do anything at all? Can you post the code? What about your implementation of a knockback function without rigidbody doesn't work for you? |
wow, quick reply wasn't expecting that ha! Thanks for that initially. Here's the knockback code: Player script: private void Update() Rocket explosion script: private IEnumerator Start() Collider[] objectsInRange = Physics.OverlapSphere(explosionOrigin, explosionRadius); foreach (Collider collision in objectsInRange) Sorry if the formatting for the code is rubbish I haven't really used GitHub before... is it readable? I've also posted a question in Unity Answers where the code may be easier to read as well: Oh and forgot to mention, the code does work, sort of, however not exactly how I want it to, because while the "force" is applied, I lose control of the character, I believe this is due to the Vector3.Lerp function |
I think I did it, pretty simple actually!
Used this instead and got rid of the code in Update. Code for explosion is the same. Works quite well, may need some tweaking though. |
Quick update, I've simplified the code and I'm happy with it now: I put the .Move in there because it wasn't applying the force every single time. If you're interested in the explosion code let me know. |
Would be nice if you could contribute to this project for everyone :) could you make a pull request please?? |
No problem, never done that before but I believe I have just done it! I also added a new file for the rocket explosion (I think) which is required for the knockback function to work, can you see that? Also I'm having another issue with air control I'm going to create a new issue thread. |
I don't see a pull request :P Once you make a pull request I'll check it out, accept it and probably do some work to make it a drop in solution. I am sure many people are looking for something like this! :) |
Before checking these issues I wrote my own rocket jump addon, and it ended up very similar to what Pixelch3f put together. Now I am trying to get more advanced rocket jumping tricks to work, especially wall jumping with rockets. When I rocket jump at a wall, and then rocket jump off the wall, I expect to be propelled away from the wall, however, I often don't move. But I have also found that I can still climb the wall with a series of rocket jumps, and get speed boosts off of it if I want to do a horizontal jump away from it. Has anyone else run into this issue? I suspect that it may be the player's speed continuing in a direction toward the wall rather than getting launched away but I am new to unity and don't understand how to fix such an issue. |
You're pretty much correct: the velocity going into the wall continues even when you hit the wall and so the rocket you shoot attempts to add onto the velocity but is probably not enough to oppose the continued velocity. The script provided in this repo is simply just air control, not player-environment interaction. You'll have to handle that yourself. |
So I haven't implemented this myself, but since I have gotten busy and need to shelve my rocket jumping project for a while I thought I should share what I think would be a solution. I think that casting a ray to the point where the player collides with the object and then adding force in the opposite direction to cancel out the movement into the point of the collision might work. If I get time to try this solution myself I'll let y'all know how it goes. |
The way it's handled in Quake is to clip the player's velocity perpendicular to the surface hit. However it's a bit more complex than I described in that they resolve the clip with another clip until no more surfaces are hit. The method in question is here: https://github.com/id-Software/Quake-III-Arena/blob/master/code/game/bg_slidemove.c#L45 if you're interested in seeing the full implementation. I assume you could achieve the same effect by querying the collision in Unity, then allowing Unity to resolve it for you. |
Cool! Thanks for the resource. I'll check that out when I have time. |
Hey guys! I know this is an old thread but I'm currently trying to make my own rocket jumping. I saw these scripts and decided to try it out, however I've been having trouble actually figuring out where all the scripts go and how this all works. If you wanna talk over discord it would be better for me since I don't check GitHub often. seth#4281 |
Hey! I'm sorry to bump this old repo, but for those, who might be wondering how to implement rocket jumping, I've found a code snippet shared by PhobicGunner on the unity forums. I'm not using Unity myself, but after migrating the code it all seems to work flawlessly so far (I'm working with GameStudio A8 + Lite-C language). Here is original code snippet:
And here is the link to the forum thread: Also big THANK YOU to WiggleWizard for sharing his work! It's awesome! |
Hi Zinglish,
Sorry if I'm spamming you as I've already attempted to message you on YouTube but I'm trying to get in contact with you for a little assistance!
I've been working with your script for a little while because I'm attempting to make an FPS game with movement similar to Quake.
However I've run into an issue, I'm trying to add rocket jumping to my game but because your script uses a character controller component it can't be affected by physics. I've attempted to code a knockback force function but it doesn't work exactly how I want it to. I've even tried to convert your script to use a Rigidbody instead of a Character Controller, but I can't get that working 100%.
Do you have any light to shed on the issue? I'm 100% happy to share the work I've done on your script.
Thanks!
The text was updated successfully, but these errors were encountered: