Can I modify a primitive's size?

Post » Mon Nov 19, 2012 6:51 am

I find myself needing to use several collision boxes (L_NAVCUT) to negate some parts of the navmesh. That is all fine and dandy and works the way I need it to.

However, I would also like to modify a collision box on the fly. I'd like to change it's size (normally changed from the Primitive tab) dynamically via a script. Is it possible to modify the size of a primitive, or at least clone/duplicate a primitive via a script?
User avatar
louise hamilton
 
Posts: 3412
Joined: Wed Jun 07, 2006 9:16 am

Post » Mon Nov 19, 2012 4:16 am

You could use http://www.creationkit.com/SetScale_-_ObjectReference on it, probably.

Edit SetScale doesn't work while Disable, Enable, Moveto, SetPositionX/Y/Z and GetPositionX/Y/Z work.
User avatar
CHARLODDE
 
Posts: 3408
Joined: Mon Apr 23, 2007 5:33 pm

Post » Mon Nov 19, 2012 3:25 am

Based on that, it looks like it doesn't update collision and I'm not sure the Primitive size is the same as scale, but I'll give it a go.
User avatar
Evaa
 
Posts: 3502
Joined: Mon Dec 18, 2006 9:11 am

Post » Mon Nov 19, 2012 12:16 pm

SetScale(0) should, I'd imagine, behave just like Disable(). If your primitive is a 2048^3 collision cube, would not setting its scale to 0.5 make it a 1024^3?
User avatar
Beulah Bell
 
Posts: 3372
Joined: Thu Nov 23, 2006 7:08 pm

Post » Mon Nov 19, 2012 7:04 am

Yes, it could do that potentially, but that means the collision box could never change a size on a specific axis. For instance, if I needed it wider.
User avatar
Maria Leon
 
Posts: 3413
Joined: Tue Aug 14, 2007 12:39 am

Post » Mon Nov 19, 2012 1:15 pm

On primitives (Trigger volumes, collision boxes), no, you can't. As you mention, the collision domain won't update after scaling. There are also no functions to change its size on particular axes.
User avatar
Angus Poole
 
Posts: 3594
Joined: Fri Aug 03, 2007 9:04 pm

Post » Mon Nov 19, 2012 1:54 pm

Just place multiple of them and use enable() and disable() to turn on the correctly sized ones and off the other ones, as you can't scale a primative via script.
User avatar
gemma king
 
Posts: 3523
Joined: Fri Feb 09, 2007 12:11 pm

Post » Mon Nov 19, 2012 7:06 am

Ok, then on to the second part of the post. Duplicating a primitive. I'm assuming a new clone of a primitive can't be placed via PlaceAtMe?
User avatar
Laura Shipley
 
Posts: 3564
Joined: Thu Oct 26, 2006 4:47 am

Post » Mon Nov 19, 2012 9:51 am

Ok, then on to the second part of the post. Duplicating a primitive. I'm assuming a new clone of a primitive can't be placed via PlaceAtMe?
Yep. http://www.creationkit.com/PlaceAtMe_-_ObjectReference just watch for the little tricks and wot-not described in the notes towards the end

You could use GetForm method, if nothing else (see the notes)

(at least I think yes ... this does work for primitives, right?!)
User avatar
gemma king
 
Posts: 3523
Joined: Fri Feb 09, 2007 12:11 pm

Post » Mon Nov 19, 2012 12:30 pm

Primitive data isn't stored in the form though, it's stored per instance. And it looks like PlaceAtMe doesn't take ObjectReferences as its parameter so it looks like I am out of luck on this one. By chance, does anybody know if there are any NIF based tricks I can use on models to trick the AI into pathfinding around them? Back in Fallout NV, I was able to set the object layer type on the NIF to clutter and they would try to path around it as if it was a havok object. That doesn't seem to work anymore. The only method I've found of spoofing a collision is using L_NAVCUT based primitives. I'd just like to find a way for objects placed with PlaceAtMe to have a rudimentary form of collision. I've got it working with things that are only placed once, as I can move a collision layer on top of it, but for things that can be placed multiple times (fence segments), I haven't yet found a way to accomplish this. Any insights?
User avatar
A Lo RIkIton'ton
 
Posts: 3404
Joined: Tue Aug 21, 2007 7:22 pm

Post » Mon Nov 19, 2012 1:12 pm

Primitive data isn't stored in the form though, it's stored per instance.
Then I'm not sure ... they may be another couple of tricks - well there are, but I don't know if they work with primitives (which are basically "references" by the sound of it) - So I'll check in the CK later (much later) if no one else has figured out a way by then.
User avatar
Avril Churchill
 
Posts: 3455
Joined: Wed Aug 09, 2006 10:00 am

Post » Mon Nov 19, 2012 6:36 am

...basically "references" by the sound of it...
They are REFRs of CollisionMarker [STAT:00000021]. Enable/Disable works, but SetScale doesn't. All I can think of is having a bunch of premade ones of various sizes and filling an array with 'em, moving the next size up/down to the current and moving the--

Wait, you could just make a sphere and move it up down so it will intersect more or less of the NAVM. Moveto, SetPositionX/Y/Z and GetPositionX/Y/Z work.
User avatar
Mizz.Jayy
 
Posts: 3483
Joined: Sat Mar 03, 2007 5:56 pm

Post » Mon Nov 19, 2012 1:21 pm

They are REFRs of CollisionMarker [STAT:00000021]. Enable/Disable works, but SetScale doesn't. All I can think of is having a bunch of premade ones of various sizes and filling an array with 'em, moving the next size up/down to the current and moving the--

Yeah, I was going to test this worked ... but if you are saying it works then pointless me testing ... do it this way, Elderwind (assuming you can make a set of viable clones in the CK pre-runtime?)


Wait, you could just make a sphere and move it up down so it will intersect more or less of the NAVM. Moveto, SetPositionX/Y/Z and GetPositionX/Y/Z work.
You're madder than a box of frogs, you are!! :wink:
User avatar
Peetay
 
Posts: 3303
Joined: Sun Jul 22, 2007 10:33 am

Post » Mon Nov 19, 2012 2:44 am

Had as a matter! :)

Just tried, before posting the above of course
Spoiler
ScriptName ADisposableScript Extends ObjectReferenceInt iHotkey01 = 203 ; LeftInt iHotkey02 = 208 ; DownInt iHotkey03 = 205 ; RightInt iHotkey04 = 200 ; UpBool bIsHotkey01PressedBool bIsHotkey02PressedBool bIsHotkey03PressedBool bIsHotkey04PressedObjectReference Property CollisionMarkerREF AutoEvent OnInit()	RegisterForSingleUpdate(0.25)EndEventEvent OnUpdate()	If bIsHotkey01Pressed != Input.IsKeyPressed(iHotkey01)		bIsHotkey01Pressed = !bIsHotkey01Pressed		If bIsHotkey01Pressed			Enable()			Debug.Notification("Enabled")		EndIf	ElseIf bIsHotkey02Pressed != Input.IsKeyPressed(iHotkey02)		bIsHotkey02Pressed = !bIsHotkey02Pressed		If bIsHotkey02Pressed			MoveTo(Self, 0.0, 0.0, -10.0)			Debug.Notification("GetPositionZ() == " + GetPositionZ())		EndIf	ElseIf bIsHotkey03Pressed != Input.IsKeyPressed(iHotkey03)		bIsHotkey03Pressed = !bIsHotkey03Pressed		If bIsHotkey03Pressed			Disable()			Debug.Notification("Disabled")		EndIf	ElseIf bIsHotkey04Pressed != Input.IsKeyPressed(iHotkey04)		bIsHotkey04Pressed = !bIsHotkey04Pressed		If bIsHotkey04Pressed			MoveTo(Self, 0.0, 0.0, 10.0)			Debug.Notification("GetPositionZ() == " + GetPositionZ())		EndIf	EndIf	RegisterForSingleUpdate(0.25)EndEvent
...with a sphere and, if standing on it and pressing up/down, the player would rise/fall. L_NavCut collision objects do update instantly when where they intersect a NavMesh changes, so a single persistent sphere would seem to be the way to go rather than an ObjectReference array of cubes.
User avatar
April
 
Posts: 3479
Joined: Tue Jun 20, 2006 1:33 am

Post » Mon Nov 19, 2012 2:15 am

Thanks for all the time spent on this guys.

As I said before, it wouldn't make sense for me to have a lot of premade ones because there can be an infinite amount of these objects placed that need collision (not infinite truly, due to bloat, but you get the idea). Wouldn't the sphere solution fall into the same category? I know I can enable/disable collision refs/spheres, but I can't resize them (I can scale, but not size) and I can't clone them.
User avatar
Lawrence Armijo
 
Posts: 3446
Joined: Thu Sep 27, 2007 7:12 pm

Post » Mon Nov 19, 2012 3:13 pm

Thanks for all the time spent on this guys.

As I said before, it wouldn't make sense for me to have a lot of premade ones because there can be an infinite amount of these objects placed that need collision (not infinite truly, due to bloat, but you get the idea). Wouldn't the sphere solution fall into the same category? I know I can enable/disable collision refs/spheres, but I can't resize them (I can scale, but not size) and I can't clone them.
I think the-mad-one means to create an ENORMOUS sphere and then move it up and down (on the Z-Axis) ... so that the bit "touching the ground" is smaller/larger as it is moved (if you see what he means ...)

:wink:



And because said idea IS madder than a very full box of frogs, how about rethinking what you are doing? (If you can).

I use DISTANCE quite a lot, to start a quest/event when something approaches a particular place. So I'll have the player check for the distance to another character (or character check character), even actor/character check distance to an "object" or a "marker".

Using this: http://www.creationkit.com/ObjectReference.GetDistance_%28Papyrus%29

Works like a charm ... if you can use it?
User avatar
Hairul Hafis
 
Posts: 3516
Joined: Mon Oct 29, 2007 12:22 am

Post » Mon Nov 19, 2012 6:40 am

Nope, the GetDistance won't work. My issue here revolves around using primitives to cut the navmesh.
User avatar
Life long Observer
 
Posts: 3476
Joined: Fri Sep 08, 2006 7:07 pm

Post » Mon Nov 19, 2012 11:56 am

Well then:
  • If you must use primitives
  • If you can't make a set of clones of varying sizes
  • If there's no other workaround

Then it looks like sticking your head into Justin's box-of-frogs might be the only way? (If the massive sphere will also cut the navmesh the way you want it?)

If not then ... :(
User avatar
Dragonz Dancer
 
Posts: 3441
Joined: Sat Jun 24, 2006 11:01 am

Post » Mon Nov 19, 2012 3:23 am

L_NavCut Sphere intersecting a NAVM will work. Primitives like these are the only way to dynamically enable/disable NavMeshes. I played with the idea of a Dragonbreath mod so actors would steer clear of the player after eating garlic using such a sphere which followed the player. A Draugr would come after me, but would back off if I stepped toward him as if repelled by the garlic breath. If I fled, he'd follow never getting closer than 256 units away.

What size chunks of NAVM must be disabled? Provided the max is < 512 http://www.creationkit.com/Unit, it shouldn't ever intersect the NAVM triangles on the floor beneath/above you.

An SKSE function for changing primitives would be cool...
User avatar
Elle H
 
Posts: 3407
Joined: Sun Aug 06, 2006 3:15 am

Post » Mon Nov 19, 2012 12:11 am

Yeah, that is basically the concept I have working currently. Except, there is a placeable 'fence' object that can be placed multiple times, and for each time it is placed I'd like a L_NAVCUT layer applied on top of it. So it looks like there isn't a way to modify/duplicate a primitive.
User avatar
Lucky Girl
 
Posts: 3486
Joined: Wed Jun 06, 2007 4:14 pm


Return to V - Skyrim