Product Chat / [SOLVED] Can't get dynamic lights following a bulb, in pendular motion

Author
Message
3com
10
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 27th Aug 2019 16:35
Hi guys
As title say, I has sometime trying to sort it with no to avail.

Shadows going relastively fine, but lights does not.
I thinks lights has mysteries than I don't know, more info about their behaviour may help a lot to understand with some things does not work as expected, even using the new light lua commands.

Maybe Prebem comes and explain us if it is do-able nowaday, what I want to achieve.

Using prompt to debug I can realize both bulb and dynamic light being in same position, so why I can't see the light behaves as expected?
Even the angles are similar. I know the light/bulb pos/angle should be update constantly, should be like create a pointer to the bulb pos/angle, and addressed of.

So the question is, it is do-able nowaday, using the new lua toys?



A lua command to attache one object to another, say the child linked to the parent, and the child follow the parents wherever he go.

What you think guys?
Laptop: Lenovo - Intel(R) Celeron(R) CPU 1005M @ 1.90GHz

OS: Windows 10 (64) - Ram: 4 gb - Hd: 283 gb - Video card: Intel(R) HD Graphics
cpu mark: 10396.6
2d graphics mark: 947.9
3d graphics mark: 8310.9
memory mark 2584.8
Disk mark: 1146.3
Passmark rating: 3662.4

The author of this post has marked a post as an answer.

Go to answer
PM
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 27th Aug 2019 16:56
What Lua commands are you using to move the light? Are you giving them the correct light Id?

Been there, done that, got all the T-Shirts!
PM
3com
10
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 27th Aug 2019 21:22
this is what I've so far:

Laptop: Lenovo - Intel(R) Celeron(R) CPU 1005M @ 1.90GHz

OS: Windows 10 (64) - Ram: 4 gb - Hd: 283 gb - Video card: Intel(R) HD Graphics
cpu mark: 10396.6
2d graphics mark: 947.9
3d graphics mark: 8310.9
memory mark 2584.8
Disk mark: 1146.3
Passmark rating: 3662.4

PM
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 27th Aug 2019 22:45 Edited at: 27th Aug 2019 22:51
you know that for loop will just be the same as
posx, posy, posz, rotx, roty, rotz = GetObjectPosAng( obj )
SetLightPosition ( lightNum, posx, posy - 10, posz ) --200
SetLightAngle( lightNum, rotx, roty, rotz )
range = GetLightRange ( lightNum )
SetLightRange ( lightNum, range+10000 )

right? but this method doesn't waste 10000 loops as the light won't get updated in the shader til the end of the script execution phase
i made a script that moves a light with an entity somewhere, i'll see if i can find the thread, brb
this is how you set a light angle
local rad = math.rad
local xv, yv, zv = U.Rotate3D( 0, 0, 1 , rad( xA ), rad( yA ), rad( zA ) )
SetLightAngle( light, xv, yv, zv )"
where xA etc is the angle of the entity to match
more info from this thread
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 27th Aug 2019 23:07
The list called light doesn't appear to be set anywhere.

What are you attaching this script to?
Been there, done that, got all the T-Shirts!
PM
3com
10
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 28th Aug 2019 00:02
light {} is with the intention of adding more lights in other places of the house, this idea is not yet developed, first I want to move the light with the bulb.

I do not want to move the light independently based on its position and angle, what I want is very simple, the light is the son and the bulb is the father, and the son follows the father wherever he goes.
The script is attached to the bulb.
The loop was a last check I wanted to do, I forgot to undo this modification before posting the script, I'm sorry.

First, the script must update the position and angle of the bulb at all times, and pass these values ​​to the light, thus getting the light to follow the bulb at all times, position, and angle.
But the light completely ignores the script and remains immobile.
And I do not know why?
Something I am doing wrong, or just can not?
That's why I want to know if it's worth trying or if we have to wait for GG to evolve favorably.
Although I repeat, through a prompt I verified that both occupy the same coordinates and angle, well the light has some offset with respect to the bulb.
Laptop: Lenovo - Intel(R) Celeron(R) CPU 1005M @ 1.90GHz

OS: Windows 10 (64) - Ram: 4 gb - Hd: 283 gb - Video card: Intel(R) HD Graphics
cpu mark: 10396.6
2d graphics mark: 947.9
3d graphics mark: 8310.9
memory mark 2584.8
Disk mark: 1146.3
Passmark rating: 3662.4

PM
3com
10
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 28th Aug 2019 00:25
I'm looking for something like this, well not exactly, but almost.

Laptop: Lenovo - Intel(R) Celeron(R) CPU 1005M @ 1.90GHz

OS: Windows 10 (64) - Ram: 4 gb - Hd: 283 gb - Video card: Intel(R) HD Graphics
cpu mark: 10396.6
2d graphics mark: 947.9
3d graphics mark: 8310.9
memory mark 2584.8
Disk mark: 1146.3
Passmark rating: 3662.4

PM
GubbyBlips
5
Years of Service
User Offline
Joined: 14th Jan 2019
Location:
Posted: 28th Aug 2019 02:58
3com; Question-- is your swinging light an animated object or is the effect
produced moving it x,y,z through script?

Do you know the N, S, E, and W compass directions the light moves--
and how much variation it has?

You should just be able (as far as I imagine) to match the bulb x,y,z to
the light x,y,z-- that is unless it's an animated object. Then it would (for me)
be a matter of prodding GG until it reveals the map-points that the bulb swings,
and plugging that into the light x,y,z.

I only messed with lights one time to see if indeed they will move, and indeed
they did move. Should be pretty simple if we know animated, or coordinated.


PM
3com
10
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 28th Aug 2019 17:14
Quote: "is your swinging light an animated object or is the effect
produced moving it x,y,z through script?"

The bulb is animated mesh.

Quote: "You should just be able (as far as I imagine) to match the bulb x,y,z to
the light x,y,z"

The question is light does not respond to this settings, even if you match booth coords, the light does nothing. There should be something about lights behaviour than I've missed, or it's not revealed yet, or simply I'm doing something wrong.
Laptop: Lenovo - Intel(R) Celeron(R) CPU 1005M @ 1.90GHz

OS: Windows 10 (64) - Ram: 4 gb - Hd: 283 gb - Video card: Intel(R) HD Graphics
cpu mark: 10396.6
2d graphics mark: 947.9
3d graphics mark: 8310.9
memory mark 2584.8
Disk mark: 1146.3
Passmark rating: 3662.4

PM
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 28th Aug 2019 18:29
This post has been marked by the post author as the answer.
here is a swinging light script which should point you in the right direction
name the light fixture something unique then name the light the same but add "_light"
so
"swinging_light" & "swinging_light_light" etc


p.s. the new commands only work with the new spot lights as you can't rotate the old lights
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11

Attachments

Login to view attachments
3com
10
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 28th Aug 2019 19:57
I'm going to give a try, Thanks smallg.
Laptop: Lenovo - Intel(R) Celeron(R) CPU 1005M @ 1.90GHz

OS: Windows 10 (64) - Ram: 4 gb - Hd: 283 gb - Video card: Intel(R) HD Graphics
cpu mark: 10396.6
2d graphics mark: 947.9
3d graphics mark: 8310.9
memory mark 2584.8
Disk mark: 1146.3
Passmark rating: 3662.4

PM
3com
10
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 28th Aug 2019 21:01
Your script passes the coordinates to the bulb and rotates the object at the same time as in the light, since my bulb is an animated object, the movement is forced, so I tried a non-animated bulb and it works well.
The problem is the rotation of the bulb, if you observe in the video above, the base of the bulb remains immobile, while only the bulb and the cable move pendulously and with a slight rotation, while in the video from below rotates the whole object, which does not fit, it is an obstacle that I will have to overcome.
Thanks smallg for the assistance, the light moves and that is the important thing.



Quote: "p.s. the new commands only work with the new spot lights as you can't rotate the old lights"

I know there should be something I was missing.
Laptop: Lenovo - Intel(R) Celeron(R) CPU 1005M @ 1.90GHz

OS: Windows 10 (64) - Ram: 4 gb - Hd: 283 gb - Video card: Intel(R) HD Graphics
cpu mark: 10396.6
2d graphics mark: 947.9
3d graphics mark: 8310.9
memory mark 2584.8
Disk mark: 1146.3
Passmark rating: 3662.4

PM
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 28th Aug 2019 21:23
yes that's because the light has its origin in the center of the model so you will have to modify it to be at the base but it doesn't matter what you rotate, just make the light in 2 parts if you want the base to stay still, you don't even really need another object for the script at all if you don't want to, you can just pass in the desired angles manually but this is more confusing imo and obviously much less user friendly.
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
3com
10
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 30th Aug 2019 16:57
I have managed to get the coordinates that the bulb occupies in each frame of the animation, and I have discovered that it is always the same.
This reinforces my idea that an animated object remains static, and what we are seeing is only an animation, therefore the coordinates that the bulb can pass to the light, are always the same, since the bulb is actually static, It does not move.
For this reason the light does not move either, since it always occupies the same position, just like the bulb.
Maybe it's crazy, but what we need would be the coordinates of the animation.

This is what I've so far



Laptop: Lenovo - Intel(R) Celeron(R) CPU 1005M @ 1.90GHz

OS: Windows 10 (64) - Ram: 4 gb - Hd: 283 gb - Video card: Intel(R) HD Graphics
cpu mark: 10396.6
2d graphics mark: 947.9
3d graphics mark: 8310.9
memory mark 2584.8
Disk mark: 1146.3
Passmark rating: 3662.4

PM
Belidos
3D Media Maker
9
Years of Service
User Offline
Joined: 23rd Nov 2015
Playing: The Game
Posted: 30th Aug 2019 17:10 Edited at: 30th Aug 2019 17:11
Quote: "This reinforces my idea that an animated object remains static, and what we are seeing is only an animation"


Why does it reinforce? It's common knowledge, you can't get any more enforced than that

Seriously though, yes, an animation does not change it's location, if it's a standard animation that does not use bones then there is no way to get it to follow the animation as far as i know (maybe using tricky math and move commands, i'm not sure though). If the bulb has a bone, then you may be able to use the character limb system to attach the light to the bone, but that's way beyond my level of understanding.

Primary Desktop:
i7 7700,k NV1070 8GB, 16GB 3200mhz memory, 1x 2TB Hybrid, Win10.

Secondary Desktop:
i5 4760k, NV960 2GB, 16GB 2333mhz memory, 1x 2TB Hybrid, Win10.

Laptop:
i3, Intel 4000 series graphics, 6GB memory, 1x 500gb HDD, Win8.1.
3com
10
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 30th Aug 2019 17:59
You are right, maybe I have not expressed myself well, my doubt was if the engine somehow traced the coordinates of the animation, after all Mr. Lee dominates those mathematics of which you speak, for this reason I did a test , to be sure.

Maybe I don't find it as obvious as you do, and I need to verify it, after all I feel free to do it as many times as I want.
Laptop: Lenovo - Intel(R) Celeron(R) CPU 1005M @ 1.90GHz

OS: Windows 10 (64) - Ram: 4 gb - Hd: 283 gb - Video card: Intel(R) HD Graphics
cpu mark: 10396.6
2d graphics mark: 947.9
3d graphics mark: 8310.9
memory mark 2584.8
Disk mark: 1146.3
Passmark rating: 3662.4

PM
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 30th Aug 2019 18:28
yh it isn't as obvious as it seems as some engines actually do report the realtime location of objects throughout their animation but normally only if the object is made up of parts or limbs and GG does as long as the origin moves in the animation but in this case the animation is not moving the origin of the object but the mesh itself moves / is transformed... thus the reported location is always the same... i don't think there is any way to return such info without returning shader info (as afaik you need to know the vertex positions in real time) unless you hardcode it based on the animation info taken from a modelling program then use some of amen's commands to offset the light
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
GubbyBlips
5
Years of Service
User Offline
Joined: 14th Jan 2019
Location:
Posted: 30th Aug 2019 18:33
3com; have you thought of just scripting the movement of the light,
the actual (bulb/object) and equate those same coordinates to the dynamic
light? Slightly tricky, but not incredibly.
PM
3com
10
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 30th Aug 2019 19:08
@ smallg and GubbyBlips
I thought about this possibility, that is another reason why I looked for GG to inform me of the position and angle of the bulb in each frame of the animation by means of a loop, but it always returned the same position, which gave me confirmed that GG did not track the coordinates of the animation.
I may find a way to find out these coordinates automatically, because it can be exhausting manually. LOL
Laptop: Lenovo - Intel(R) Celeron(R) CPU 1005M @ 1.90GHz

OS: Windows 10 (64) - Ram: 4 gb - Hd: 283 gb - Video card: Intel(R) HD Graphics
cpu mark: 10396.6
2d graphics mark: 947.9
3d graphics mark: 8310.9
memory mark 2584.8
Disk mark: 1146.3
Passmark rating: 3662.4

PM
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 30th Aug 2019 20:01
This is why my bullet holes script can't be used on things like doors because opening the door would leave the bullet holes floating in mid air!

Would be nice to be able to call a function which specifies a point on a model relative to the origins 'frame 0' and have GG return the equivalent point relative to the current animation frame, not sure if that would be even possible though.
Been there, done that, got all the T-Shirts!
PM
3com
10
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 30th Aug 2019 20:20
Quote: "This is why my bullet holes script can't be used on things like doors because opening the door would leave the bullet holes floating in mid air!"

Yes, I even tried to create a blood stain on the soldiers' uniform when they received a shot, with your script, but it is not possible for that reason.

we need the way to know the animation coordinates.
There are many applications for this, I am imagining a police car, rocket headlights, a mobile alarm, the light not only has to be attached to the player, it also has to be attached to an object.
Laptop: Lenovo - Intel(R) Celeron(R) CPU 1005M @ 1.90GHz

OS: Windows 10 (64) - Ram: 4 gb - Hd: 283 gb - Video card: Intel(R) HD Graphics
cpu mark: 10396.6
2d graphics mark: 947.9
3d graphics mark: 8310.9
memory mark 2584.8
Disk mark: 1146.3
Passmark rating: 3662.4

PM
GubbyBlips
5
Years of Service
User Offline
Joined: 14th Jan 2019
Location:
Posted: 31st Aug 2019 04:46
Does anyone know of an object model (Stock entity) that is pointy
like a sword or arrow and has the zero x,y,z points at the arrow point?

If there was one, or 3com if you would like to model one real quick...
I would be willing to make up a easy map point finder tool-- script.

Also I have been thinking for a while now how handy a ruler with accurate
GG map x,y,z scale would be for some instances in modeling, scripting, etc.

Examples...

Attachments

Login to view attachments
PM
GubbyBlips
5
Years of Service
User Offline
Joined: 14th Jan 2019
Location:
Posted: 31st Aug 2019 04:53
This is all fine and handy when you aren't trying to grab animated points,
but now that I think about it, with this "red-neck" way of manually getting
coordinates, it would all be little use without some kind of timer synchronization.

It would have to be scripted to time right anim vs move...
PM
3com
10
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 31st Aug 2019 05:21
@ GubbyBlips
It's not exactly what you want to achieve, but it might help.

Laptop: Lenovo - Intel(R) Celeron(R) CPU 1005M @ 1.90GHz

OS: Windows 10 (64) - Ram: 4 gb - Hd: 283 gb - Video card: Intel(R) HD Graphics
cpu mark: 10396.6
2d graphics mark: 947.9
3d graphics mark: 8310.9
memory mark 2584.8
Disk mark: 1146.3
Passmark rating: 3662.4

PM

Login to post a reply

Server time is: 2024-11-24 01:13:02
Your offset time is: 2024-11-24 01:13:02