Merge pull request #2373 from QuantumCoderQC/pick-rb-imp
add normal output for pick rb node
This commit is contained in:
commit
326d3bbf0d
|
@ -4,8 +4,6 @@ import iron.math.Vec4;
|
||||||
|
|
||||||
class PickObjectNode extends LogicNode {
|
class PickObjectNode extends LogicNode {
|
||||||
|
|
||||||
var v = new Vec4();
|
|
||||||
|
|
||||||
public function new(tree: LogicTree) {
|
public function new(tree: LogicTree) {
|
||||||
super(tree);
|
super(tree);
|
||||||
}
|
}
|
||||||
|
@ -24,9 +22,14 @@ class PickObjectNode extends LogicNode {
|
||||||
if (from == 0) { // Object
|
if (from == 0) { // Object
|
||||||
return rb.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);
|
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
|
#end
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,11 +13,12 @@ class PickObjectNode(ArmLogicTreeNode):
|
||||||
|
|
||||||
@output RB: the object that was hit
|
@output RB: the object that was hit
|
||||||
@output Hit: the hit position in world coordinates
|
@output Hit: the hit position in world coordinates
|
||||||
|
@output Normal: the hit normal in world coordinates
|
||||||
"""
|
"""
|
||||||
bl_idname = 'LNPickObjectNode'
|
bl_idname = 'LNPickObjectNode'
|
||||||
bl_label = 'Pick RB'
|
bl_label = 'Pick RB'
|
||||||
arm_section = 'ray'
|
arm_section = 'ray'
|
||||||
arm_version = 1
|
arm_version = 2
|
||||||
|
|
||||||
def arm_init(self, context):
|
def arm_init(self, context):
|
||||||
self.add_input('ArmVectorSocket', 'Screen Coords')
|
self.add_input('ArmVectorSocket', 'Screen Coords')
|
||||||
|
@ -25,3 +26,4 @@ class PickObjectNode(ArmLogicTreeNode):
|
||||||
|
|
||||||
self.add_output('ArmNodeSocketObject', 'RB')
|
self.add_output('ArmNodeSocketObject', 'RB')
|
||||||
self.add_output('ArmVectorSocket', 'Hit')
|
self.add_output('ArmVectorSocket', 'Hit')
|
||||||
|
self.add_output('ArmVectorSocket', 'Normal')
|
||||||
|
|
Loading…
Reference in a new issue