spotlight shadow effect

liux2355liux2355 Member, BASIC Posts: 33

Hello, I am making a game involving sweeping spotlight. I have several actors move around and I want my actors block the light and create a shadow behind them. The shape of the shadow should depends on the angle between the light and the actor. I don't know how to realize this. I attached an image to demonstrate this. Thank you.

Go Download "Sub Run" in App Store.

Comments

  • liux2355liux2355 Member, BASIC Posts: 33

    I know I can spawn a "shadow" actor and constrain its position related to the blue actors, but how can I make the shape of the shadow change when my light is shooting from a different angle.

    Go Download "Sub Run" in App Store.

  • SocksSocks London, UK.Member Posts: 12,822
    edited November 2015

    @liux2355 said:
    I know I can spawn a "shadow" actor and constrain its position related to the blue actors, but how can I make the shape of the shadow change when my light is shooting from a different angle.

    You could replicate in the opposite direction (= from main actor to light source) using the Replicate behaviour . . . . hold on, I'll make a quick demo of what I mean . . . .

    . . . . .

    EDIT: demo attached/ drag the light source around (smaller pale yellow square).

  • liux2355liux2355 Member, BASIC Posts: 33

    @Socks said:

    @liux2355 said:
    I know I can spawn a "shadow" actor and constrain its position related to the blue actors, but how can I make the shape of the shadow change when my light is shooting from a different angle.

    You could replicate in the opposite direction (= from main actor to light source) using the Replicate behaviour . . . . hold on, I'll make a quick demo of what I mean . . . .

    . . . . .

    EDIT: demo attached/ drag the light source around (smaller pale yellow square).

    It works great but in my case, I have a fixed light source and my actor is spawned randomly and move around, then this method can not work. What should I do if I want to move the actor and shadow instead of light. Thanks.

    Go Download "Sub Run" in App Store.

  • SocksSocks London, UK.Member Posts: 12,822
    edited November 2015

    @liux2355 said:
    It works great but in my case, I have a fixed light source and my actor is spawned randomly and move around, then this method can not work.

    It was just a demo file to show the concept of using Replicate to make the shadow, you are not stuck with a moving light source and a static actor, you can set it up any way you like.

    If you want the actor to move with the shadow then constrain the actor's x and y position to the shadow's x and y position.

  • liux2355liux2355 Member, BASIC Posts: 33

    @Socks said:

    @liux2355 said:
    It works great but in my case, I have a fixed light source and my actor is spawned randomly and move around, then this method can not work.

    I was just a demo file to show the concept of using Replicate to make the shadow, you are not stuck with a moving light source and a static actor, you can set it up any way you like.

    If you want the actor to move with the shadow then constrain the actor's x and y position to the shadows x and y position.

    I've been working on it for some time and it works pretty well. Thank you!

    Go Download "Sub Run" in App Store.

Sign In or Register to comment.