The format of 3D vectors in custom assets

Talk about creating Grimrock 1 levels and mods here. Warning: forum contains spoilers!
Post Reply
vorebane
Posts: 41
Joined: Wed Oct 03, 2012 4:31 am

The format of 3D vectors in custom assets

Post by vorebane »

I am trying to create a custom anvil, cloning off of the altar. As it's currently sized, the position of items resting on it is entirely misplaced. I understand that to change where the items are placed, I need to use the fields of anchorPos and anchorRotation in the define object script. I don't know what is meant by '3d vector' though, and searching the internet and the forums hasn't solved it for me yet. Has anyone figured this one out yet, or is there a standard notation I've missed?
User avatar
Komag
Posts: 3659
Joined: Sat Jul 28, 2012 4:55 pm
Location: Boston, USA

Re: The format of 3D vectors in custom assets

Post by Komag »

the position is an X Y X system where it's in 3D space as you look forward (not down from above), X is left and right (right +), Y is up and down (up +) and Z is forward and back (forward +), with 0,0,0 being on the floor in the middle of the tile (IIRC)
Finished Dungeons - complete mods to play
vorebane
Posts: 41
Joined: Wed Oct 03, 2012 4:31 am

Re: The format of 3D vectors in custom assets

Post by vorebane »

This makes sense, but it does not seem to be working for me. When I write anchorPos = 0, 50, 0, hopefully getting some amount off the ground, I get an error loading the dungeon in question, stating a table was expected where the editor got a number. Whether I use square, curly or pointy brackets, I get an unexpected error. When I use round brackets, it just doesn't change anything. Based on Grimwold's custom note hook, I discovered that the accepted format seems to be 'vec(0,0,0)' but even this seems to have absolutely no effect on where the item rests, so I still have a very nice anvil shaped object with astounding powers of levitation. Given that the editor only seems to load up custom scripts the first time it loads a dungeon with such scripts, and it demands I open the client proper before I open the editor, I am really wishing this was documented somewhere instead of making me guess and scour the internet trying to make a floating object move an inch. I'm going to beat my head against a wall for awhile, that seems more productive.
User avatar
Grimwold
Posts: 511
Joined: Thu Sep 13, 2012 11:45 pm
Location: A Dungeon somewhere in the UK

Re: The format of 3D vectors in custom assets

Post by Grimwold »

Yeah, the correct format for anchorPos is as follows:

Code: Select all

anchorPos = vec(0, 1.65, 0),
and tiles are 3x3x3.

If you want to be able to place items on the anvil, and remove them, you will also need to adjust targetPos and targetSize in the same way.


EDIT - I think there might be slight differences between how Altars and Alcove's work, so if you have defined your Anvil with class="Altar" that might explain why it's not acting how we expect.

I was working on something using this stone crab: viewtopic.php?f=14&t=3411&start=270#p41503 but after repeatedly reloading my project after changing the anchor and then trying to get the target right, I gve up.
User avatar
Neikun
Posts: 2457
Joined: Thu Sep 13, 2012 1:06 pm
Location: New Brunswick, Canada
Contact:

Re: The format of 3D vectors in custom assets

Post by Neikun »

Altars have no anchorPos/anchorRotation
Lets hope the devs implement it
-though it would be difficult, I have faith in them!-
"I'm okay with being referred to as a goddess."
Community Model Request Thread
See what I'm working on right now: Neikun's Workshop
Lead Coordinator for Legends of the Northern Realms Project
  • Message me to join in!
User avatar
Grimwold
Posts: 511
Joined: Thu Sep 13, 2012 11:45 pm
Location: A Dungeon somewhere in the UK

Re: The format of 3D vectors in custom assets

Post by Grimwold »

Neikun wrote:Altars have no anchorPos/anchorRotation
Lets hope the devs implement it
-though it would be difficult, I have faith in them!-
Is it possible to use a logical alcove to achieve the desired effect?
User avatar
Komag
Posts: 3659
Joined: Sat Jul 28, 2012 4:55 pm
Location: Boston, USA

Re: The format of 3D vectors in custom assets

Post by Komag »

I don't see why not. Just make an object that is a blocker or something, with the altar model, then set up custom socket()
Finished Dungeons - complete mods to play
User avatar
Neikun
Posts: 2457
Joined: Thu Sep 13, 2012 1:06 pm
Location: New Brunswick, Canada
Contact:

Re: The format of 3D vectors in custom assets

Post by Neikun »

That is how the Metal junk blockage works. Unfortunately, the player can't grab things that are too close to the center/other side of the square.
"I'm okay with being referred to as a goddess."
Community Model Request Thread
See what I'm working on right now: Neikun's Workshop
Lead Coordinator for Legends of the Northern Realms Project
  • Message me to join in!
Post Reply