• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by Marcus · May 13, 2010 at 08:54 PM · 3dshooting2d-gameplayalign

Problem with 2D shooter Game?

**HI!

Im having a problem with my game im creating there are 2 major issues. ( Its a 2d/3d shootergame)

  1. When im shooting my rockets forward they are positioned sideways.(the model of the rocket is alined the wrong way, instead of pointing forward they are pointed to the left. How do I turn them to the right way?)

2 The second problem im having is that the rockets are being created from the top of the plane instead of starting from the wing?.**

This is the code im using.

var prefabRocket:Transform;

var shootForce: float;

function Update () {

if(Input.GetButtonDown("Jump")) { var instanceRocket = Instantiate(prefabRocket, GameObject.Find("fighter").transform.position, transform.rotation); instanceRocket.rigidbody.AddForce(transform.forward * shootForce);

 }

}

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
2
Best Answer

Answer by qJake · May 13, 2010 at 09:12 PM

  1. Your model has been oriented incorrectly in your 3D modeling program. Some modeling programs use the Y-up method, while some use the Z-up method, and this can throw off the export/import process, orienting your model wrong. (Unity uses the Y-up orientation method.) Simply rotate your rocket model in your modeling program until it's oriented correctly in Unity.

  2. You should probably add a child GameObject to your ship, and then spawn the rockets from there. That way, you can control the exact position of where you want them to spawn. As of right now, your rockets will spawn at the origin of the ship's model, which you don't have a lot of control over. I find it useful to create a "Spawn Point" child object and attach it to whatever shoots the projectile, this way I can control the exact spawn position.

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Marcus · May 19, 2010 at 09:58 PM 0
Share

Thanks Helpt alot!!

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

No one has followed this question yet.

Related Questions

How to to not move when shooting? 0 Answers

How : Player move forward automatically (global Z axis) & 'not' the direction it's facing 3 Answers

how to add firerate to enemies shooting script 0 Answers

Advanced FPS shooting 1 Answer

Enemy Will not die 1 Answer

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges