Jump to content

Raycast - bug or not ?


hulahula
 Share

Recommended Posts

@Dad72  I have one question for you  :)

I am making littel  "Space-RPG"  and question is : Can I   make  2 imported obj  in ma game like  for exampel player and door intersect with raycast (raycast is a part of the player )  if  i using this mathod

  if (rayCast.intersectsMesh(door, true)) {

    console.log("open");

  } else {

    console.log("closed");

  }

   I have littel problem whit it ? it  doesn't register intersection 

Link to comment
Share on other sites

IntersectMesh is for meshes that detects another one. Your code here will not work, I think.

You have to do something like

if (character.intersectsMesh(door, true)) {

    console.log("open");

  } else {

    console.log("closed");

  }

 

Link to comment
Share on other sites

If you use RayCast you do not need IntersectMesh :

Your ray code ...

var hit = scene.pickWithRay(ray);

if (hit.pickedMesh){
       
      var mesh = hit.pickedMesh;

       console.log("open the door");

}

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...