- Home /
Launching Projectile Problems (2D)
Edit2: I solved my problem for the sake of completeness, so that if anyone else finds this while trying to do something similar I'll explain what I did. ->I changed the monkeys prefab to default to "newMonkey" ->Any monkeys that start in the game world but not in a net are manually tagged the proper color ->Any monkey with a tag other than "newMonkey" are destroyed on contact with the hammock collider ->Instantiate a fake monkey placeholder that has no collider or rigid body at the hammock location (Just to look like a monkey is in the net) ->When the ejectMonkey button is pushed destroy the fake monkey and instantiate the real monkey and immediately apply force ->Because this monkey is tagged newMonkey it ignores the onTriggerEnter that would normally destroy it ->Then OnTriggerExit Change the monkeys tag to the proper color
Edit: I took a break to clear my head and came up with the start of a solution. I created a "netEmpty" variable and set it to true. I then adjusted my OnCollisionEnter function to be an if statement that only runs if the net is empty. It then sets the netEmpty=false and when the object is ejected in the update function returns to true. So far the monkey falls immediately but at least he is not locked in place and changes color.
So I spent about 4 hours working on this an checking other peoples questions and tried every solution suggested in those so I'm going to see if y'all can give a more tailored answer.the most recent thing I have tried is destroying and instantiating a whole new monkey.There is a lot of vestigial code here that does nothing just left overs from trying stuff out.
So let me explain what I'm trying for. I have monkeys that you shoot from hammock to hammock, when they land in a hammock they are changed to that color. Then they stay in that hammock until the mouse is clicked again then they are fired towards that click. Right now the monkey does not rotate when the net does, but I'm not worried about that right now. I just what the bugger to to get flung out when I click. Colliding, changing color, even my scoring and picking up objects this is literally my last thing to do before I start actually building levels, everything but the actual shooting part works.
The monkey prefab has a rigid body, it has a mass of .5 and gravity scale of 1. The hammock is marked as "is trigger." The monkey has no physics material but I have tried it with one with .4 friction and 1 bounciness. Thanks in advance for any suggestions.
Also sorry for the poor grammar, English was my worst subject in school. =P
Your answer
Follow this Question
Related Questions
Want to make a JRPG. 1 Answer
Strange GOs Bounce after parenting 2D game 0 Answers
The name 'Joystick' does not denote a valid type ('not found') 2 Answers
2d water simulation simulation 1 Answer
2D pong game. HELP 1 Answer