Merge pull request #2373 from QuantumCoderQC/pick-rb-imp

add normal output for pick rb node
This commit is contained in:
Lubos Lenco 2021-11-01 20:52:23 +01:00 committed by GitHub
commit 326d3bbf0d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 4 deletions

View File

@ -4,8 +4,6 @@ import iron.math.Vec4;
class PickObjectNode extends LogicNode {
var v = new Vec4();
public function new(tree: LogicTree) {
super(tree);
}
@ -24,9 +22,14 @@ class PickObjectNode extends LogicNode {
if (from == 0) { // Object
return rb.object;
}
else { // Hit
else if(from == 1){ // Hit
var v = new Vec4();
return v.set(physics.hitPointWorld.x, physics.hitPointWorld.y, physics.hitPointWorld.z);
}
else { // Normal
var v = new Vec4();
return v.set(physics.hitNormalWorld.x, physics.hitNormalWorld.y, physics.hitNormalWorld.z, 0);
}
#end
return null;
}

View File

@ -13,11 +13,12 @@ class PickObjectNode(ArmLogicTreeNode):
@output RB: the object that was hit
@output Hit: the hit position in world coordinates
@output Normal: the hit normal in world coordinates
"""
bl_idname = 'LNPickObjectNode'
bl_label = 'Pick RB'
arm_section = 'ray'
arm_version = 1
arm_version = 2
def arm_init(self, context):
self.add_input('ArmVectorSocket', 'Screen Coords')
@ -25,3 +26,4 @@ class PickObjectNode(ArmLogicTreeNode):
self.add_output('ArmNodeSocketObject', 'RB')
self.add_output('ArmVectorSocket', 'Hit')
self.add_output('ArmVectorSocket', 'Normal')