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
1
Question by BigBlob · Feb 04, 2012 at 08:33 PM · playershadowblob

Blob Shadow

Ok, how can I make my blob shadow that was included with the unity package follow the player and not to rotate with it, I want it to follow the shape according to the terrain. How can I do that.

  • Felipe

Comment
Add comment · Show 2
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 DGArtistsInc · Feb 04, 2012 at 09:54 PM 0
Share

what do you mean by follow it but not rotate with it. Do you want it to be vertically above the character looking down on it the whole time or... What?

avatar image BigBlob · Jun 27, 2012 at 07:04 PM 0
Share

Its becuase my character is rolling ball and if a shadow is a child of the ball then obviously it will rotate with it too

3 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by ActionScripter · May 24, 2012 at 04:04 PM

I had exactly this problem, but I was able to put together a robust solution based on various community answers. I think it will work for you.

Create a blob shadow projector (I think one comes in standard assets). Then slap this script on it. Once you point the variables to the player and the sun/light source in the inspector, it will work like a charm.


// ShadowFollow.js

#pragma strict

var objectToFollow : Transform; // The object you need a shadow under

var offset : Vector3; // How much to shift the projector from the object center

var lightSource : Light; // What light is "casting" the shadow

function Start () {

 transform.rotation = lightSource.transform.rotation;
 

}

function Update () {

 transform.position = objectToFollow.position + offset;
 

}

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
avatar image
0

Answer by Peter G · Feb 04, 2012 at 11:09 PM

The easiest thing to do is just parent the player to the blob shadow. That is place the blob where you want it relative to your object, then make it a child of the object. Then whenever you move the character, the shadow will follow.

Comment
Add comment · Show 1 · 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 BigBlob · Feb 04, 2012 at 11:56 PM 1
Share

Thaks but i wnat it to move the shadow with the player but not to rotate with it

avatar image
0

Answer by luniac · Feb 13, 2013 at 04:39 AM

Ok I don't know how the hell that other script is supposed to function, but here's mine.

The "5f" value affects how high above the ball the shadow projector is, you can change it to whatever you like, it affects how much the size of the shadow changes with distance from floor. Actually the commented out code is the original "transform.position = transform.parent.position + Vector3.up * 15f;"

Make sure the projector is a child of the ball.

 //BlobShadowController.cs
 
 using UnityEngine;
 using System.Collections;
 
 public class BlobShadowController : MonoBehaviour
 {
     void Update()
     {                                                                
           transform.position = transform.parent.position + Vector3.up * transform.parent.localScale.y * 5f;//* .50f;
 //        transform.position = transform.parent.position + Vector3.up * 15f;
 //        Debug.Log(transform.position);
         transform.rotation = Quaternion.LookRotation(-Vector3.up, transform.parent.forward);
     }
 }
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

8 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

[Unity3D 3.5.6f4] Get rid of shadow projector artefact 1 Answer

Will other player see what I see? 1 Answer

Blob shadow problem 2 Answers

Blob shadow changes transparency 2 Answers

Best way to use a blob shadow for a surface with varying height (for mobile) 0 Answers


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