raycasting

Galaxies simulation: Change color of a point and display text on mouseover

半腔热情 提交于 2020-05-30 06:31:09
问题 I am trying to create a simulation of positions of 4673 of the nearest galaxies. The galaxies are points. I want to color a point on mouseover and load the name of the galaxy. I have spent many days trying to achieve it. I am able to change color, as well as do basic raycasting, however, I am unable to separately raycast/color individual point. All the points are raycasted and colored as a group as seen in the current version. What should I do to correct this? Thank you so much for your time

Getting uneven click-detection on 3d-objects on mapbox with raycaster

瘦欲@ 提交于 2020-05-17 06:05:41
问题 I am using raycaster in mapbox with 3d-objects. I need to detect the click on the 3d-object.But When I click on the object I get a empty raycaster.intersectObject (array) sometimes and filled array sometimes, rather it should always have the 3d object that I have clicked. I have a simple map as explained here. I have only added the raycasting part to it to keep it as simple as possible. Here is my code. var longitude, latitude, diff, map, destLongitude, destLatitude, distFrmlast = 0; var

How to use Raycast methods in RealityKit?

廉价感情. 提交于 2020-02-23 05:23:53
问题 There are three ways about Detecting Intersections in RealityKit framework, but I don't know how to use it in my project. 1. func raycast(origin: SIMD3<Float>, direction: SIMD3<Float>, length: Float, query: CollisionCastQueryType, mask: CollisionGroup, relativeTo: Entity?) -> [CollisionCastHit] 2. func raycast(from: SIMD3<Float>, to: SIMD3<Float>, query: CollisionCastQueryType, mask: CollisionGroup, relativeTo: Entity?) -> [CollisionCastHit] 3. func convexCast(convexShape: ShapeResource,

How to use Raycast methods in RealityKit?

前提是你 提交于 2020-02-23 05:23:19
问题 There are three ways about Detecting Intersections in RealityKit framework, but I don't know how to use it in my project. 1. func raycast(origin: SIMD3<Float>, direction: SIMD3<Float>, length: Float, query: CollisionCastQueryType, mask: CollisionGroup, relativeTo: Entity?) -> [CollisionCastHit] 2. func raycast(from: SIMD3<Float>, to: SIMD3<Float>, query: CollisionCastQueryType, mask: CollisionGroup, relativeTo: Entity?) -> [CollisionCastHit] 3. func convexCast(convexShape: ShapeResource,

Moving a instantiated gameobject

馋奶兔 提交于 2020-01-17 05:03:15
问题 I want to change the position of a instantiated game object . For that I have used a UI button when the user clicks on the button a cube will be instantiated and when user clicks on that instantiated cube and move a UI slider , the position of that cube will be changed according to the value given by the slider. I tried this way but it doesn't work. What am I doing wrong here using UnityEngine; using System.Collections; public class instantiate : MonoBehaviour { public GameObject cube; public

Raycasting after dynamically changing Mesh in Three.js

北慕城南 提交于 2020-01-14 05:37:13
问题 I have a mesh cloned from another mesh. But after cloning, I translate and rotate it. And do a ray-casting a point to it but it is not working as expected. It is keep intersecting with the original position before translation and rotation. Sample code is as below const raycaster = THREE.Raycaster() const proposedModel = model.clone() proposedModel.translateX(1) proposedModel.translateY(1) proposedModel.translateZ(1) const q = new THREE.Quaternion( -0.847, -0.002, -0.505, 0.168 ) proposedModel

Raycast to get gameobject being hit to run script and function on gameobject

大憨熊 提交于 2020-01-07 01:22:34
问题 I'm in the process of getting multiple enemies to work in my game for my college project. I have a player with a ShootGun script which raycasts the gun and detects whether or not the object hit is one of the enemy colliders (tagged with Enemy_Head, _Torso and _Limb). If it is, it will get the gameobject of the enemy hit and the enemyHealth script component on that gameobject and will then call public functions on that script. Currently, when the ShootGun script tries to get the component /

Ignore other layers collider in raycast [duplicate]

☆樱花仙子☆ 提交于 2020-01-06 21:41:10
问题 This question already has answers here : Raycasting only to a particular object (2 answers) Using Layers and Bitmask with Raycast in Unity (2 answers) Closed 2 years ago . I am willing to raycast specific layer and ignore other layers no matters its colider is above to my navPoint layer object? int specificLayerMask = LayerMask.GetMask("NavPoint");//raycast only this layer ignore others if (Physics.Raycast(raycastObject.transform.position, fwd, out objectHit, specificLayerMask))//50 {} the

I never get inside if (Physics.Raycast(ray, out hit,Mathf.Infinity, touchInputMask)

感情迁移 提交于 2020-01-06 07:11:20
问题 What I want to do is when user touch a object he can move it, and specially with multitouch finger on the screen I tried to do this ray with mouse click too, but still have the same problem for that, I use this code on update public LayerMask touchInputMask; private static List<GameObject> touchList = new List<GameObject>(); public static Dictionary<int, objectst> touchobjects = new Dictionary<int, objectst>(); private GameObject[] touchesOld; private RaycastHit hit; public GUIText Count,

I never get inside if (Physics.Raycast(ray, out hit,Mathf.Infinity, touchInputMask)

烂漫一生 提交于 2020-01-06 07:11:10
问题 What I want to do is when user touch a object he can move it, and specially with multitouch finger on the screen I tried to do this ray with mouse click too, but still have the same problem for that, I use this code on update public LayerMask touchInputMask; private static List<GameObject> touchList = new List<GameObject>(); public static Dictionary<int, objectst> touchobjects = new Dictionary<int, objectst>(); private GameObject[] touchesOld; private RaycastHit hit; public GUIText Count,