Jump to content
NunesSergio

Object type from p3d proxy reference

Recommended Posts

Hello there!

I'm trying to account for soldiers being spawned inside of rocks, so I figured I'd draw a line upwards above the soldier's head, pick the object of the first surface the line touches and call it a day.

The thing is, the command does not throw me classname objects, it throws me proxy objects (p3d).

 

Here is my code:

_pos = getPosASL _unit;
_objs = lineIntersectsWith [_pos, _pos vectorAdd [0,0,10], _unit];
_objs

//This gives me: [155305: sharprock_spike.p3d]

 

As you can see, that's just the kind of object I want to detect. But passing it through isKindOf doesn't help.

Other "line" commands (lineIntersectsObjs, lineIntersectsSurfaces, etc), give me the same result.

 

How can I detect if that object is a rock?

The only thing I could think of was to convert that using str and check for "rock" in the resulting string, but I assume that's just sloppy and could cause some false alarms.

Share this post


Link to post
Share on other sites
3 hours ago, Harzach said:

Have you tried BIS_fnc_findSafePos?

 

Yes I use this a lot, but when spawning a whole group, the safe position is only guaranteed to be the group leader's. The other members spawn in formation (or any other) and can end up more often than not under terrain rocks 😞

I just didn't want to use findSafePos for every single unit I spawn.

Share this post


Link to post
Share on other sites
1 hour ago, NunesSergio said:

but when spawning a whole group

 

Make sure your value for objDist (fourth param) is greater than the size of your group's formation footprint.

  • Like 2

Share this post


Link to post
Share on other sites

This is of course the best solution:

12 hours ago, Harzach said:

Have you tried BIS_fnc_findSafePos?

 

Nevertheless there are ways to detect rocks which have no classnames.

 

If you do not get a classname (using the typeOf command) which you could examine then you have the option to get nearby terrain objects with nearestTerrainObjects.

  • Like 1

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×