HeroEngine Forums
Welcome, Guest. Please login or Register for HeroCloud Account.

Author Topic: GetNodeUnderMouse() and Prop Bucket Items  (Read 2440 times)

nocake

  • General Accounts
  • *
  • Posts: 404
    • View Profile
    • BlightMMO
GetNodeUnderMouse() and Prop Bucket Items
« on: Nov 14, 14, 06:07:48 AM »

I can't seem to get GetNodeUnderMouse() to return anything when clicking on a node I created in a prop bucket. This object is added to the world/area and is activated. MouseTargetable is also set to true and when I select the node in Hero Engine Mode I can see the property is set correctly.

Does the external function GetNodeUnderMouse() not consider Prop Bucket Instances?

If it does is there a property i need to set other than MouseTargetable true?
« Last Edit: Nov 14, 14, 06:22:10 AM by nocake »
Logged

FI-ScottZ

  • General Accounts
  • *
  • Posts: 1407
    • View Profile
    • Forever Interactive, Inc.
Re: GetNodeUnderMouse() and Prop Bucket Items
« Reply #1 on: Nov 14, 14, 11:05:28 AM »

EDIT: Disregard that last message.  I was thinking of the other function.

But still, maybe the raycast external functions will work.
« Last Edit: Nov 14, 14, 11:10:22 AM by ScottZarnke »
Logged
Scott Zarnke
Lead Programmer, Visions of Zosimos
CTO, Forever Interactive, Inc.

FI-ScottZ

  • General Accounts
  • *
  • Posts: 1407
    • View Profile
    • Forever Interactive, Inc.
Re: GetNodeUnderMouse() and Prop Bucket Items
« Reply #2 on: Nov 14, 14, 11:13:22 AM »

What are the settings of it for MouseTransparent and Selectable?
Logged
Scott Zarnke
Lead Programmer, Visions of Zosimos
CTO, Forever Interactive, Inc.

nocake

  • General Accounts
  • *
  • Posts: 404
    • View Profile
    • BlightMMO
Re: GetNodeUnderMouse() and Prop Bucket Items
« Reply #3 on: Nov 14, 14, 04:12:06 PM »

MouseTransparent set to true or false doesnt change the outcome


Selectable always set to True




Also I dug this up : https://community.heroengine.com/forums/index.php/topic,3168.msg22945.html#msg22945

Last comment leads me to think its fixed now? I can get a node id back when click on objects I added through the Library, just not for nodes added through the prop bucket system.


Code: [Select]
  CreatePropBucket("newbucket")
 
  slotbeam as NodeRef
  slotbeam = AddAssetSpecToPropBucket("newbucket", "\engine\cleangame\resources\common\utility_box_white01.gr2")
 
  slotbeamID as ID = slotbeam                 
 
  if (IsAssetSpecReady("house", slotbeamID))
      slotbeaminstance as NodeRef = CreateInstanceFromPropBucket("newbucket", slotbeam)
      slotbeaminstance["Scale"] = (.15,4,.15)
      slotbeaminstance["MouseTargetable"] = true
      slotbeaminstance["MouseTransparent"] = true

      slotbeaminstanceID as ID = slotbeaminstance
      ActivateInstance(slotbeaminstanceID, "")
.




« Last Edit: Nov 14, 14, 04:15:52 PM by nocake »
Logged

Jrome90

  • General Accounts
  • *
  • Posts: 330
    • View Profile
Re: GetNodeUnderMouse() and Prop Bucket Items
« Reply #4 on: Nov 14, 14, 04:20:06 PM »

Try:

Glomming a class onto the prop.
In the class that is glommed onto it, use:

Code: [Select]
shared function InputMouseEvent(args references Class _MouseEvent)
This  function is what the prop system uses.
« Last Edit: Nov 14, 14, 04:21:40 PM by Jrome90 »
Logged

nocake

  • General Accounts
  • *
  • Posts: 404
    • View Profile
    • BlightMMO
Re: GetNodeUnderMouse() and Prop Bucket Items
« Reply #5 on: Nov 14, 14, 04:26:12 PM »

I tried this approach

GlomClass("Beam",slotbeaminstance)

in BeamClassMethods:

Code: [Select]
shared function InputMouseEvent(args references Class _MouseEvent)
  println("args "+args.MouseTarget)
 
.

Never prints anything when mousing over or clicking.

Is this set up correctly?



Code: [Select]
14:29:00: System:CLI command /sn 1000011951.
14:29:00: System:SN LISTBEGIN 1000011951 : "Node ID: 1000011951 Base Class ID: 3775000003 Name: "HBNode""
SN LISTELEMENT 1000011951 : "Additional Class ID: 9223372078910132665 Name: "Beam" Description: "beam""
SN LISTELEMENT 1000011951 : "Field ID: 9223372078910132666 Name: "BeamPosition" Value: "(0.400000006,0,1.600000024)""
SN LISTELEMENT 1000011951 : "Field ID: 9223372078910132667 Name: "BeamSlot" Value: "B5""
SN LISTELEMENT 1000011951 : "Field ID: 3775000002 Name: "LW_FIELD_Script" Value: "*None*""
SN LISTEND 1000011951 : "End of List."


« Last Edit: Nov 14, 14, 04:50:26 PM by nocake »
Logged

Jrome90

  • General Accounts
  • *
  • Posts: 330
    • View Profile
Re: GetNodeUnderMouse() and Prop Bucket Items
« Reply #6 on: Nov 14, 14, 04:45:07 PM »

Yeah, that should work.

This is what I use for the instance properties:

Code: [Select]
    instance as NodeRef = CreateInstanceFromPropBucket(bucketName,spec)
    instance["PhysicsType"] = "Static"
    instance["PhysicsShape"] = "Exact_Mesh"
    instance["MouseTargetable"] = true
   
    ActivateInstance(instance,"")
« Last Edit: Nov 14, 14, 04:46:57 PM by Jrome90 »
Logged

nocake

  • General Accounts
  • *
  • Posts: 404
    • View Profile
    • BlightMMO
Re: GetNodeUnderMouse() and Prop Bucket Items
« Reply #7 on: Nov 14, 14, 04:45:45 PM »

Your edit worked for both GetNodeUnderMouse and InputMouseEvent !


I needed to add:
Code: [Select]
instance["PhysicsType"] = "Static"
instance["PhysicsShape"] = "Exact_Mesh"


On a side note this also solved prop bucket items being non-collidable. Players now collide correctly with them. Prop Bucket Instance Collision.


Thanks for the help!
« Last Edit: Nov 14, 14, 04:58:27 PM by nocake »
Logged

Jrome90

  • General Accounts
  • *
  • Posts: 330
    • View Profile
Re: GetNodeUnderMouse() and Prop Bucket Items
« Reply #8 on: Nov 14, 14, 04:59:26 PM »

Your edit worked for both GetNodeUnderMouse and InputMouseEvent !


I needed to add:
Code: [Select]
instance["PhysicsType"] = "Static"
instance["PhysicsShape"] = "Exact_Mesh"


On a side note this also solved prop bucket items being non-collidable. Players now collide correctly with them.

This is why: https://community.heroengine.com/forums/index.php/topic,740.msg3402.html#msg3402

Anyways, glad you got it working
Logged