Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
13 Jun 22 - 14 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by Biendeo · Oct 03, 2010 at 08:35 AM · lightingshadowprojectorblob

Blob Shadows - Reversing Shadow Effect?

Hi, I have a question relating blob shadows that I've come across.

Just starting, I am able to attach blob shadows to objects, and get a blob shadow to move with it. I have also looked at another question's script, which forces the blob shadow to always face downward even though its parented to another object. I have also been able to ignore layers, so the shadow will not be displayed on the object itself.

The blob shadow gets bigger when the object moves away from a surface. What I want is the blob shadow to get smaller as it moves away. This'll make the blob shadow appear from nowhere, rather than a large black dot appearing, before it shrinks and the object lands.

I hope you guys can help! :D

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

2 Replies

· Add your reply
  • Sort: 
avatar image
2

Answer by anomalous_underdog · Oct 03, 2010 at 11:54 AM

You need code that makes the projector move downwards when the object moves upwards.

Paste this code to a new C# script. Assign it to your object, then drag and drop the blob shadow projector to the script's shadow property.

EDIT: Doing the changes required by Biendeo was harder than I thought, but eventually I figured out a solution.

using UnityEngine; using System.Collections;

public class InverseYMovement : MonoBehaviour { public Transform shadow; public float characterHeight = 5.0f;

 private float initialY = 0.0f;
 private float groundHeight = 0.0f;

 void Start()
 {
     initialY = shadow.transform.position.y;
 }

 void LateUpdate()
 {
     Vector3 pos = shadow.transform.position;
     pos.y = groundHeight + initialY - (transform.position.y - groundHeight);
     shadow.transform.position = pos;

     RaycastHit hit;
     int groundLayers = 1 << 0; // put here the layer where the ground/platforms are
     if (Physics.Raycast(transform.position + new Vector3(0, characterHeight, 0), -Vector3.up, out hit, Mathf.Infinity, groundLayers))
     {
         groundHeight = hit.point.y;
     }
 }

}

Comment
Add comment · Show 7 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image GODLIKE · Oct 03, 2010 at 03:33 PM 0
Share

Great, Underdog, I was looking for something like that a while ago!

avatar image Biendeo · Oct 03, 2010 at 08:19 PM 0
Share

This does work for the most part for me, but I'm making a platformer, and the character will jump up onto a ledge, but the shadow will become smaller. Is there any way to fix it so the shadow looks the same no matter at what altitude the player is at?

avatar image anomalous_underdog · Oct 04, 2010 at 06:30 AM 0
Share

@Biendeo: I thought you wanted the shadow to get smaller as the character jumps. If you want it to stay the same size always, forget about the script I showed and just make sure the Orthographic property is checked on the projector component.

avatar image Biendeo · Oct 05, 2010 at 02:03 AM 0
Share

I should clarify what I said. I do want the shadow to become smaller as the player moves away from the ground. However, when playing my game, the projector will move closer to the ground when the player stands on a higher ledge, eventually reaching a point where the projector will move below the platform itself. I wanted to ask how to reset the projector's position when the player moves over a new platform.

avatar image anomalous_underdog · Oct 05, 2010 at 07:35 PM 0
Share

@Biendeo: Ok, now I understand. initialY will need to be changed everytime the character lands on the ground/platform. I'm not on my dev machine right now, so I'll edit the code when I get the chance.

Show more comments
avatar image
0

Answer by keatona · Jan 07, 2018 at 07:48 AM

HAVE YOU TRIED FLIPPING THE PROJECTOR UPSIDE DOWN LOL

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

1 Person is following this question.

avatar image

Related Questions

How do you make blob shadow ignore sphere? 1 Answer

How to make a blob shadow project from a fixed angle as the object rotates? 2 Answers

Blob shadow projector is not projecting properly 2 Answers

Blob shadow changes transparency 2 Answers

Projector (Blob Shadow) does not work properly 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges