How to read NodeID with mousepick?

Everything related to 3D programming
T4r4ntul4
Enthusiast
Enthusiast
Posts: 119
Joined: Tue Mar 04, 2014 4:15 pm
Location: Netherlands

How to read NodeID with mousepick?

Post by T4r4ntul4 »

hey guys,

for some reason i cant find a answer to this: How to read NodeID with mousepick?

i did try this: (both ofcourse in If MouseButton(#PB_MouseButton_Left) etc etc)

Code: Select all

Entity = MousePick(0, MouseX(), MouseY())
nodenr = NodeID(1)
Debug "nodenr: "+Str(nodenr)
and then:

Code: Select all

Entity = MousePick(0, MouseX(), MouseY())
nodenr2 = EntityParentNode(Entity)
Debug "nodenr2: "+Str(nodenr2)
both snippets gives me a long number, i know it gives the system number, but i just want the NodeID as given with the creation of the node. is this possible?
User avatar
Samuel
Enthusiast
Enthusiast
Posts: 756
Joined: Sun Jul 29, 2012 10:33 pm
Location: United States

Re: How to read NodeID with mousepick?

Post by Samuel »

Not possible as far as I know.

What I would do is keep track of what nodes are linked to what entities by using an array or structure.
Then when an entity is picked just look up whatever node is linked to it.
T4r4ntul4
Enthusiast
Enthusiast
Posts: 119
Joined: Tue Mar 04, 2014 4:15 pm
Location: Netherlands

Re: How to read NodeID with mousepick?

Post by T4r4ntul4 »

okay thnx for the answer. iam gonna use a Map for it, its easier for my situation.
T4r4ntul4
Enthusiast
Enthusiast
Posts: 119
Joined: Tue Mar 04, 2014 4:15 pm
Location: Netherlands

Re: How to read NodeID with mousepick?

Post by T4r4ntul4 »

btw, whats the purpose of EntityParentNode() ?
the documentation says:
Syntax

Result = EntityParentNode(#Entity)
Description

Returns the parent NodeID().
Parameters

#Entity The entity to use.

Return value

Returns the parent NodeID(), if any. This can be either a real node, or a bone if the entity is attached to a bone. If the entity has no parent node, it will returns 0.
Supported OS

All
but it gives only that long number, it dont seem logical to give that long number if you read the docs.
User avatar
Comtois
Addict
Addict
Posts: 1432
Joined: Tue Aug 19, 2003 11:36 am
Location: Doubs - France

Re: How to read NodeID with mousepick?

Post by Comtois »

EntityParentNode() can be useful for commands that require a NodeID(). You dont need to create a node, then attach one entity to this node, you can use directly EntityParentNode().
See the example NodeAnimation2.pb
Please correct my english
http://purebasic.developpez.com/
T4r4ntul4
Enthusiast
Enthusiast
Posts: 119
Joined: Tue Mar 04, 2014 4:15 pm
Location: Netherlands

Re: How to read NodeID with mousepick?

Post by T4r4ntul4 »

okay thanks, now i understand =)
Post Reply