You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
raytrace:cast(object, origin, direction) is good not for all situations as I understand.
Sometimes it's better to cast from one point to another one and get first or all intersections.
For example, I use construction like this in old version of 3Dreamengine to detect mouseclicks at mobs:
local _pos = dream:pixelToPoint(vec3(mX, mY, 0));
local _point = dream:pixelToPoint(vec3(mX, mY, length_of_cast_ray));
local _segment = collision:newSegment(_pos, _point);
for i = 1, #_mobs do
local _collider = _mobs[i][1]:GetCollider ();
if _collider and collision:collide(_segment, _collider, true) then
…
end;
end;
--Collider can be created for every mob like:
local _collider = collision:newMesh (object);
As you can see I use vec3 points (pixelToPoint returns them) for raycast, using an object here can be not so good. Of course I can raycast all mobs in a cycle and use mobs like first param for raytrace cast. But for some reason this is not the best variant.
So, the question is: is it possible to add vec3 --> vec3 raycast method with limitation of the cast distance? It's good to get first hited object, or all hited objects in an array.
The text was updated successfully, but these errors were encountered:
Sorry for disturbing, but is there any method in new versions of 3DreamEngine to get an object by mouse click? And getting obstacles betwwen object and camera?
raytrace:cast(object, origin, direction) is good not for all situations as I understand.
Sometimes it's better to cast from one point to another one and get first or all intersections.
For example, I use construction like this in old version of 3Dreamengine to detect mouseclicks at mobs:
As you can see I use vec3 points (pixelToPoint returns them) for raycast, using an object here can be not so good. Of course I can raycast all mobs in a cycle and use mobs like first param for raytrace cast. But for some reason this is not the best variant.
So, the question is: is it possible to add vec3 --> vec3 raycast method with limitation of the cast distance? It's good to get first hited object, or all hited objects in an array.
The text was updated successfully, but these errors were encountered: