After much deliberation, I have solved the cannon issue!
Now, the player can aim the cannon, pick up a cannonball from a basket and put the cannonball on the cannon. Once the player does this, the ball will shoot out the barrel, and a new cannonball will spawn in the basket. I was overthinking the way it should work and found that this was A) the simplest solution and B) the most intuitive way to do this. Techy Stuff: For attaching the cannonball to the cannon, I used a Snap Drop Zone with parenting (so the ball will move with the cannon, as opposed to joints or kinematics) from the wonderful VRTK Unity Package. I made the zone smaller than the actual ball, so it will shrink to nothing then fire, for an added visual effect. (I plan on adding particle effects soon). On snapping the object (cannonball) to the zone, it calls a function from the script on the ball that both shoots a prefab out of the barrel, destroying after 2 seconds, (or collision with an enemy ship) and repositions the ball to the basket, making it look like one shoots, and another one spawns. This allows for really easy management of the scene because I only have to use one script on one cannonball object. Thanks for reading! - Judah Mantell President, MidnightCoffee, Inc.
Powered by
Powered by
|
About MeAside from being a game developer and CEO of MidnightCoffee, Inc, Judah teaches game design to middle and high school students. He is also a professional magician and retro game enthusiast. Categories
All
Powered by
Powered by
|