Resources
Answers
Examples
Sign in
Get Started
What do you want to save?
Add Code snippet
New code examples
C#
2021-10-21 07:33:09
unity mouse click position
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); RaycastHit hit = new RaycastHit(); if (Physics.Raycast(ray, out hit)) { return hit.point; }
Add solution
C#
2021-10-16 07:00:06
raycasting in unity
RaycastHit hit; // Does the ray intersect any objects excluding the player layer if (Physics.Raycast(transform.position, transform.TransformDirection(Vector3.forward), out hit, Mathf.Infinity, layerMask)) { Debug.DrawRa...
Add solution
C#
2021-10-16 05:59:06
how to zoom where i have mouse cursor in unity
public float zoomSpeed; public float minZoom; public float maxZoom; void Update() { Zoom(); } void Zoom() { Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); RaycastHit point; P...
Add solution
C#
2021-10-11 18:50:04
raycast unity
RaycastHit hit; // Does the ray intersect any objects excluding the player layer if (Physics.Raycast(transform.position, transform.TransformDirection(Vector3.forward), out hit, Mathf.Infinity, layerMask)) { Debug.DrawRa...
Add solution
C#
2021-10-07 05:46:04
how to know on which a gameobject is RaycastHit located
if (Physics.Raycast(cam.ScreenPointToRay(...), hit){ Destroy(hit.transform.gameObject); }
Add solution
C#
2021-10-05 20:47:02
unity3d raycast
RaycastHit hit; // Does the ray intersect any objects excluding the player layer if (Physics.Raycast(transform.position, transform.TransformDirection(Vector3.forward), out hit, Mathf.Infinity, layerMask)) { Debug.DrawRa...
Add solution
C#
2021-10-02 05:55:03
how to see a tag of what you hit with raycast
if (Physics.Raycast (transform.position, fwd, hit, Reach) && hit.transform.tag == "TagName") {
Add solution
C#
2021-09-29 11:40:03
how to do a sculpt in unity
using System.Collections; using System.Collections.Generic; using UnityEngine; using System.Linq; using UnityEditor; public class m : MonoBehaviour { Mesh mesh; Vector3[] vertices; void Start() { mesh = GetComponent<MeshFilter...
Add solution
C#
2021-09-29 03:02:02
how to raycast unit
using UnityEngine; // C# example. public class ExampleClass : MonoBehaviour { void Update() { // Bit shift the index of the layer (8) to get a bit mask int layerMask = 1 << 8; // This would cast rays only against c...
Add solution
C#
2021-09-16 04:37:02
unity raycast
RaycastHit hit; // Does the ray intersect any objects excluding the player layer if (Physics.Raycast(transform.position, transform.TransformDirection(Vector3.forward), out hit, Mathf.Infinity, layerMask)) { Debug.DrawRa...
Add solution
‹
1
2
3
›
Best helpers
daily
weekly
monthly
for 3 months
Scott Cumming
+5
Peace LX
+5
Vaishal Patel
+5
Gat
+5
Peter N
+5
show more
This website uses cookies to make IQCode work for you. By using this site, you agree to our
cookie policy
Welcome Back!
Sign up to unlock all of IQCode features:
Test your skills and track progress
Engage in comprehensive interactive courses
Commit to daily skill-enhancing challenges
Solve practical, real-world issues
Share your insights and learnings
Sign in
E-mail
Password
Recover lost password
Log in
Or log in with
Not registered?
Sign up takes less than a minute
Create a Free Account
Sign up to unlock all of IQCode features:
Test your skills and track progress
Engage in comprehensive interactive courses
Commit to daily skill-enhancing challenges
Solve practical, real-world issues
Share your insights and learnings
Sign up
Email
Password
Sign up for free
Or sign up with
By signing up, you agree to the
Terms and Conditions
and
Privacy Policy
. You also agree to receive product-related marketing emails from IQCode, which you can unsubscribe from at any time.