I’m starting a learning project. The idea is that you have an archer character that is static, that has a bow attached to it that shoots arrows to targets of varying difficulty. Turns out that right at the start I’m stuck. How do I make it so that the bow rotates when the player clicks and holds the mouse anywhere on the screen? So I click+hold and move left/right and the bow rotates left/right to aim the shot. I’d like to also eventually make it portable to phones (so you’d tap+hold etc).
Make an object rotate according to mouse movement. [UNITY C#]
1.6k Views Asked by Officer Vimes At
1
There are 1 best solutions below
Related Questions in UNITY-GAME-ENGINE
- Using arrow keys to rotate an object
- know object behind another object is fully visible
- Unity3d AudioSource not creatable
- Unity3d - Input.GetKey returns true more than once
- Flurry Ads on Unity3D with Prime31 plugin
- Make screenshot of DirectX window that is hidden and doesn't have focus
- Coroutine being detected as inactive despite being active
- Unity3D: Adding charged force in relation to position
- Unity - Particles emitting non-random
- 3d mouse aim camera 3rd person vertical C#
- Unity: How would I go about creating a power up system?
- Unity - Gui Button issues (Android)
- Unity3d strange Collider behaviour
- Start() function doesn't work properly after Application.LoadLevel
- Gravity works weird
Related Questions in 2D
- Algorithm for drawing tiles on screen
- Object doesn't moving well in rotation
- Cocos2d : Shooting a ball in the direction of the mouse click/Touch
- Error: cannot convert 'int (*)[3]' to 'int (*)[100]' for argument '1' to 'void repl(int (*)[100], int, int)'
- How to add a string to a 2D array in C
- Fitting 2D sum of gaussians, scipy.optimise.leastsq (Ans: Use curve_fit!)
- Java 2D game random rectangles
- 2D perspective transform in JavaScript
- List of 2D Arrays with numpy
- Make two physics objects not collide but do detect collisions in Unity
- Index of an array from a 2d np.array in Python?
- Generate 2D grid with alternation probability
- how to add Scoring to unity3D 2d top down car game?
- Blurring in PyGame
- Destroy Gameobject according to distance value
Related Questions in QUATERNIONS
- Three.js, Camera rotation around a point
- Rotating a Cube using Quaternions in PyOpenGL
- Rotate Point3D around Unit Vector
- How can I read/transform the range images of the stanford bunny .ply-files?
- Custom C++ Quaternion Rotation Not Working Correctly
- Android get quaternion data
- Quaternion to EulerXYZ, how to differentiate the negative and positive quaternion
- iOS orientation estimation and heading error
- Is It Possible To Create A Quaternion Twist Solution Which Allows For 360 Degrees Rotation?
- Rotation iteration through 3d space using quaternions
- Make an object rotate according to mouse movement. [UNITY C#]
- Is there the possibility to set a single component of a boost quaternion?
- What is a quaternion? And how is it used in graphics?
- Three.js Camera Quaternion offset for gyro input
- Rotate model to face direction it's traveling in 3d with scenekit and swift - Boids implementation
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Stack Overflow isnt a code writing service but i will explain what you must do:
Method 1 (Exact Aiming):
For every frame the mouse is down:
Rayfrom a screen point... hint (usecamera.ScreenPointToRay).Rayusingray.GetPoint(distance);.Bow.Transform.LookAt(newPoint, Vector3.Up);.Method 2 (Continuous Movement):
oldMousePosto store aVector2location.(newMousePos - oldMousePos).normalized;.(newMousePos - oldMousePos).sqrMagnitude;.