|
Hi: I want to be able to hold, drag and catapult an object from a corner of the screen to the opposite corner at an angle and speed from my drag. Download the #1 game on the Apple Store to see what I mean. Help, Chepe
(comments are locked)
|
|
Copying Tetrad's comment since he didn't post it as an answer... Well you usually have some position in the world that your sling shot is in ( Then your drag will move your projectile to some other position in the world ( Subtract these two vectors to get a new vector from the projectile to the sling shot:
Use the vector's direction to set the force direction, and the magnitude to set the force amount (where further away is higher force magnitude, obviously). Actually you can do that just by setting the force directly to the vector, possibly with a multiplier:
From there's it's usually a matter of just making sure your physics properties are set up right. More info here: http://unity3d.com/support/documentation/Manual/Physics.html
(comments are locked)
|
|
I know how to drag the object but what would be the best way to calculate the force and angle based on the position of the drag. Again Im an artist, so Im giving it my best shot. I will post my code here very soon ... Well you usually have some position in the world that your sling shot is in. Then your drag will move your projectile to some other position in the world. Subtract these two vectors to get a new vector from the projectile to the sling shot. Use the vector's direction to set the force direction, and the magnitude to set the force amount (where further away is higher force magnitude, obviously). From there's it's usually a matter of just making sure your physics properties are set up right. More info here: http://unity3d.com/support/documentation/Manual/Physics.html
Jun 05 '10 at 06:40 PM
Tetrad
Also, don't answer a question with another question/comment. Read the FAQ: http://answers.unity3d.com/faq
Jun 05 '10 at 09:39 PM
qJake
(comments are locked)
|

Not only have you provided a insufficient description of what you are trying to acheive, you have shown no initiative to understand the problem, let alone solve it. We are not here to make your game, please try to refine your concept and ask a more specific question.
Your question is too broad to be answered. If you have a specific problem, feel free to ask about it.
So you would like to clone the #1 game from the AppStore, but don't know how?
Ye, I think it's like that. Not only, he also wants somebody else do the job! LOL
@Petroz @SpikeX, @GODLIKE : Please keep the tone in here friendly. This is NOT a place to point fingers at any users. @Ricardo : I understand the question fine and I don't thik it's that broad. Please don't use the "too broad question" card unless absolutely necessary.