playMaker

Author Topic: Raycast alternatives  (Read 1623 times)

greg

  • Junior Playmaker
  • **
  • Posts: 68
    • View Profile
Raycast alternatives
« on: February 12, 2013, 07:39:23 AM »
I heard that raycasts can hit performance pretty hard. What are the alternatives? Does mousePick use a raycast, or is it something different? Basically looking for ways to lower the performance cost of raycasts.

I'm making an fps, if my player is looking at an object, and within a certain distance of it, it would be good to put "pick up gun", "open door"..etc, would this mean raycasting every frame and seeing what we hit?

Thanks

Andrew.Lukasik

  • Full Member
  • ***
  • Posts: 134
    • View Profile
    • my twitter @andrewlukasik
Re: Raycast alternatives
« Reply #1 on: February 12, 2013, 02:42:01 PM »
Hi,
 I don't know full answer to this but it might be worth keeping in mind that items can check isVisible, check distance and raycast toward player too.
 As general rules it's advised to raycast only on selected layers and preferably with simplest collision geometry.

A.