i use this as a very basic beginning of our archery system. it works.

this is client only and in combination with a dynamic object (arrow) that is created, but

this should return you the nodeID of any node that is straight ahead of the camera, which ever

way the camera is facing at the time.

The debug Draw is helpful to ensure which way the Ray is being cast.

This is very basic, so ignore the comments etc. I borrowed this from HJREF and began converting it

to my needs. I needed to understand the way the RayCast function was working and this was a good

place to start. It isnt accurate EVERY direction you face, something I've not yet gone back and fixed.

so adjust the vector where i comment below to get the angle etc you want.

Using Boss's example above should give a clue as to how to adjust the vector for more accuracy.

If you check hit_node for NONE that would tell you if you hit something.

i'll make a few comments to explain what i did.

`camera_object as NodeRef = GetActiveCamera()`

start_pos as Vector3 = GetCameraPosition( camera_object["CameraName"] )

rotation as Vector3 = GetNodeRotation( camera_object )

rotation.y = MungeHeadingDegrees(rotation.y - 180)

//weapon_spec as NodeRef of Class FPS_WeaponSpec = me._specRef

//Adjusted the y to 180, as otherwise it shoots behind the camera.

adjusted_rotation as Vector3 = rotation// - (0,180,0)

adjusted_rotation.x *= -1

//here, i was still working on the issue of it shooting behind the camera

// if rotation.y > 0.0 and rotation.y <= 180.0

// adjusted_rotation.y *= -1

// else if rotation.y > 180.0 and rotation.y <= 360.0

// adjusted_rotation.y = 360.0 - rotation.y

// .

if adjusted_rotation.y < 0

adjusted_rotation.y = adjusted_rotation.y * -1

else

adjusted_rotation.y = 0 - adjusted_rotation.y

.

//adjust (0,0,-1) to get your RayCast Angle. this may take some experiementing.

//but should get you started.

direction as Vector3 = RotateVector( (0,0,-1), adjusted_rotation - (0,180,0) )

excluded_nodes as List of NodeRef

add back SYSTEM.INFO.PLAYERCHARACTER to excluded_nodes

hit_node = Raycast3D( start_pos, direction, excluded_nodes, distance, intercept, mesh_name )

#if DEBUG

//message as String = SYSTEM.EXEC.THISFUNCTION+", mesh_name:"+mesh_name +", hit_node:"+hit_node +", intercept:"+intercept

//println(message+(1.0,1.0,0.5))

//

DrawDebugRay(start_pos, start_pos + (direction * 10), 0.05, "FF0000", "FF0000", 1.0, false)

if intercept != (0,0,0)

DrawDebugPoint(intercept, 0.1, "00FF00", 1.0, true)

.

#endif