Welcome, Guest! Login | Register
how to get id of the skinmesh at runtime
Info
Report
49 Posts

If i pick object (skinmesh). i want to know its id(handle, OBJ_XX or handle Value). How will i do that. Is it possible ?
Created on: 4 months ago
Info
Report
460 Posts

There's a couple ways, have you tried the "EventOnObjectId" object ??

( add a skinmesh and a script object and a textprint object to a project first)
-Connect both the skinmesh and textprint to the script object in the list editor

Then add this script to the scrip object
void Main()
{
   string Data;
   iStringStr(Data, OBJ_0, "%f");
   iObjectTextSet(OBJ_22, Data);
}
Then run the project

The number printed will be the objests ID
This ID is assigned by the order the objects are connected to the project, you can control the assigned ID only by adding those objects to the project in a specific order ( if you were wondering.
Also, moving objects in the list editor does not change the objects ID)

You can also play with the "iObjectHandle(int);" script command, by printing it's return value.
Created on: 4 months ago
Edited on: 4 months ago
Info
Report
49 Posts

I wonder how to get objectid on mouseoverskinmesh event. How do i  know the id of the skinmesh on which mouseover event fire. Is their any way to do that?
Created on: 4 months ago
Info
Report
103 Posts

in projects, is MouseOverSkinMesh example, you sure as heck don't need to call dll3impact.dll you asked about as it's functions are already used and/or accessible by script.
Created on: 4 months ago
Info
Report
49 Posts

if there is 100 sprite then i have to write to 100 if statement. example (if (IN_33 ==xxx){}). This huge code can be reduced if i get the object id of skinmesh onmouseoverskinmesh event.
example
if (id == xxxid)
{

}

i found a way to get the id of rigidbody objects but didnot find a way to do it on skinmesh
Created on: 4 months ago
Info
Report
460 Posts

for your 100 statement issue..

Use a if statement loop
void Main()
{
   for(int A=0; A<1000; A++){
      if(A==234) iObjectTextSet(OBJ_0, ""+A);
   }
}
/// OBJ_0 = TextPrint object
These will be a much shorter script and can be very large if needed

This loop still counts to 1000 each engine cycle, and only sets the text value when the if test = 234 then continues counting.
( if you wanted instead to stop the loop when it reach's a value, you can add a break; command inside the loop)( this simply breaks or jumps out of the loop and can save some processing power).

I assume you are using the scanner object, if so, this object only works with physics based objects like rigidbodies.

It mite be more helpful if you tell us what your trying to do in your project that requires  the element ID for...
There may be another way to identify the element for your needs.

3drad is pretty good for being able to get the results you want using different methods.

Also i feel like i should explain something to you...

In the text set statement i'm tricking 3drad into printing a unconverted int value by forcing it to do a math process..
that is adding ""+A  The text set object only works with strings, so by adding a blank string "" it wont complain and internally it converts the integer to a string for us.

If you don't do this, or i should say, we should use the  iStringStr(string,float,string);  script command to convert the integer to a string before printing.

This cheat process forces 3drad to do it internally instead.
(it's a little trick i picked up many years ago using B.A.S.I.C ).
Created on: 4 months ago
Edited on: 4 months ago
Info
Report
49 Posts

i have created an inventory. i am creating 500 items like diablo. when item is picked i need the id of the object without execution of forloop and if statement as this for loop and if statement (which are 500) waste cpu time.
Created on: 4 months ago
Edited on: 4 months ago
Info
Report
103 Posts

obviously, you do not have 500 items onscreen at once, [if you did you would still be wasting cpu and also gpu time regardless of using object id or not] so you need to split them into categories, keeping in mind a for loop for 60 items takes 1 second.
Created on: 4 months ago
Info
Report
49 Posts

i dont have 500 items onscreen at once then how to know the list of items which are visible?
if item is dropped and if i get the id of the skinmesh then i dont need to use for loop 100 times. I can do whatever i want with that object without looping all items.
Created on: 4 months ago
Info
Report
103 Posts

i3DPointVisible(OBJ_X,Vector3)

again, you'll have to split this in to items in use/available in that area, etc to reduce loop times
Created on: 4 months ago
Info
Report
49 Posts

I dont want to manually put OBJ_X value. It will destroy the whole purpose. I want to find OBJ_X value at runtime.
Created on: 4 months ago
Info
Report
103 Posts

then you'll have to use rigid body id's, though you don't have to write the code, it still uses an internal code loop for 500 RB's, and will be slooooooow,  so you'll still need to split them up and/or make an inventory list.

you said 'This huge code can be reduced if i get the object id of skinmesh' - well, no it can't, as you are trying to use a feature of the physics engine for skins which is just not possible, probably not even in other game engines. id's exist only for collision detection, the graphics engine has no need or capability for that, if it did, it would slow rendering.
the next best thing is 'enable rendered pixels stats' for skins as long as each item will not overlap, but this will yet again require a code loop of 500, there is no getting past that without splitting. otherwise you either have a loop of 500 if's to check each item per frame if cpu can handle it, or a for loop checking 1 item per frame, where the 500th item needs the player to focus on it for 8secs, while the 120th item takes 2secs.
Created on: 4 months ago
Edited on: 4 months ago
Info
Report
460 Posts

I think Jason you're looking at this problem in very basic way and it needs creativity to do what you want.

I can think of a couple differnt ways to referance items using arrays for example and creative naming.

I cant or should say wont explain this in detail because it needs to be developed as you make your project and depends heavily on how your project is set up.

I hope that makes sense to you.. try to use creative ways to get the job done, rather then 500 items in you project plus how many hundred more items......

You would really be pushing 3drads limits pretty hard here.

Also, have you even created all these 500 skinmesh items yet or is this just the planning stage ? cause thats a ton of work and time...
Created on: 4 months ago
Info
Report
49 Posts

thanks lurker
you are right. as tinsoldier says i have to do it other ways around. I have found a solution of my problem. Thanks  you explained that. i have created 100 items and trying creating more.
Created on: 4 months ago
Info
Report
103 Posts

keep in mind you can only link 90 items per script, [90x22 = max OBJ_1980] so 500 items would need 6 scripts, even if using scanner id's with 1 line of code.
Created on: 4 months ago
Edited on: 4 months ago
Info
Report
219 Posts

Quote from: thelurker

keep in mind you can only link 90 items per script, [90x22 = max OBJ_1980] so 500 items would need 6 scripts, even if using scanner id's with 1 line of code.

As far as I can know, you can use objects in the script by using their ID directly (i.e their index in the object list).
Created on: 4 months ago
Info
Report
103 Posts

take it you mean iObjectHandle, if so, it still requires the object to be linked to the script [so still 90 max] and is of no use when the OP wants to know what item the player dropped/picked up in game.
Created on: 4 months ago
Reply
Preview
Post
Or use the advanced reply form here...
Sponsored