#Yeah I have that set on the card deal
1 messages ยท Page 1 of 1 (latest)
here's one way to approach this
function setSnapPoints(deckPos)
local allSnapPoints = Global.getSnapPoints()
local positionList = {}
local startXPos = deckPos.x + offSet
for cardCount = 1, playerNum do
local newPos = {
x = deckPos.x + startXPos,
y = deckPos.y,
z = deckPos.z
}
local snapPoint = {
position = newPos,
rotation = {0, 0, 0},
rotation_snap = true,
tags = {}
}
table.insert(positionList, newPos)
table.insert(allSnapPoints, snapPoint)
startXPos= startXPos + cardSpacing
end
Global.setSnapPoints(allSnapPoints)
return positionList
end
you send the position of the deck to the function and it creates a number of snapPoints based on the number of players (playerNum).
so, all snapPoints are stored in a table that are associated with an object or global
in this case, we are using Global
the snap point table that returns when you use getSnapPoints() is a table of subtables
and each subtable represents a single snappoint with each of the properties of the snap point defined/described
ahh okay and then I can call to that later for setting up a new round?
yes, you could call this function any time you have a deck created/spawned and want some snap points created from its position
just need to send it the decks position
now, because you can't easily access just the position of a snappoint, i have created a separate table in this function called "positionList" that returns from the function. that way, you can easily access the positions of the snap points from a simple table. its not needed though.
are you familiar with the properties of the snap points? how the snap points actually work in-game?
Mostly yes, I suppose i have an okay understanding
ok, well, if you have questions, feel free to ask.
basically the snapPoint table created with each iteration in the for loop sets all the attributes for the snappoint
local snapPoint = {
position = newPos,
rotation = {0, 0, 0},
rotation_snap = true,
tags = {}
}```
need to pay attention to that rotation attribute. it sets the rotation based on whatever the snappoint is attached to. if its "attached" to global and you set the rotations to be the same for every snappoint and rotation_snap is true, then all your snappoints will make your objects align the exact same way, as opposed to in the same orientation of the deck (for example)
also, i just made some tiny adjustment to the function
Okay thank you, I will attempt to get this working in my code
I have got to the point where I am mostly lost as chatGPT has done alot of the work
sure thing! and thats just the first part of creating the snap points, still need to deal the cards to the snap points, but thats easy too
well, thats what this channel is for! lot of people here really know what they're doing.
It's taken me a week to get all of the card decks to deal correctly so this will be fun ๐ฎโ๐จ
lol! no worries! im still working on my first mod. its been over 2 years!
taking breaks here and there of course
but its a project that is "never finished"; theres always something more i want to add
Yeah, i just want to get this set up done and round reset as it's alot of work in game for a round reset
oh, yeah, i know what you mean!
I'm almost at the point of paying someone so I can get this done, then I'll work on the nice bits after ๐คฃ
lol!! well, at the very least you can always message me and ill try to help
If chat GPT fails me I may have to
no problem! chatGPT usually gets straight Lua right, but it doesn't have the knowledge of the TTS specifics (like snap points), but ive found it somewhat helpful.
Yeah thast what i've notcied, it's got me so far, it's come stuck with dealing the last deck but we are making progress
good luck! happy to answer questions or provide assistance if i'm available
Amazing thank you!!
sure ๐