In the input_mouse script (default Clean Engine one)
I have this
function OnMouseClick(lmb as Boolean, rmb as Boolean, mmb as Boolean, mb4 as Boolean, mb5 as Boolean) as Boolean
debugDrawPhysXCollisionRaycast(GetNodeUnderMouse())
return true
.
Then the function
function debugDrawPhysXCollisionRaycast(nodeToTest as NodeRef of Class HBNode)
distanceFactor as Integer = 5
sourcePosVec as Vector3
sourceRotVec as Vector3
headingVec as Vector3
targetingRay as Vector3
//Get our source node position and rotation
GetNodePosition(nodeToTest,sourcePosVec)
sourceRotVec = GetNodeRotation(nodeToTest)
sourceRotVec.y = MungeHeadingDegrees( sourceRotVec.y - 90 )
sourcePosVec.y = 0.1
//calculate our 'heading' vector from our current rotation
headingVec.x = -sine(sourceRotVec.y)
headingVec.z = -cosine(sourceRotVec.y)
//multiply by our 'see' distance
headingVec *= distanceFactor
//construct our collision ray from our source position, aimed in the direction our node is facing (and with a distance of distanceFactor units)
targetingRay = (headingVec)
collideIntercept as Vector3
collideNormal as Vector3
collideNode as NodeRef
$Debug._drawDebugConeOuterLines(sourcePosVec,3.0,targetingRay,1,5,10.0,"#0,1,0")
.
After Clicking(Which wil run the function debugDrawPhysXCollisionRaycast) it works once. Then if I click again. I get this error: SCRIPT ERROR: In function GetNodePostition: LightWeight Node ID not found
If I ignore that error and keep clicking it will eventually work once more.
It works every time if I click on any other object but my character.
This used to all work before.(about a week ago) The only changes I made that could maybe be the issue, I made my own character prototype to use. With a game specific PlayerCharacter Class.