Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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 Taragon · Apr 25, 2011 at 12:10 AM · startlerpzontrigger

DroppableMover Referenced - 3DPlatformer

Not sure why the droppablemover script is referenced when writing an ontrigger function in several of the scripts in the Lerpz tutorial (referenced is the Droppable mover script + an example of an ontrigger function script on a sphere object that Lerpz runs into). The question is why does the DroppableMover script get referenced in the first place? Why is it needed? It seems like it's needed in every script that involves an ontrigger function.

Droppable Mover Script

var gravity = 10.00; var collisionMask : LayerMask;

private var velocity = Vector3.zero; private var position : Vector3;

function Bounce (force : Vector3) { position = transform.position; velocity = force; }

function Update () { velocity.y -= gravity Time.deltaTime; moveThisFrame = velocity Time.deltaTime; distanceThisFrame = moveThisFrame.magnitude;

 if (Physics.Raycast(position, moveThisFrame, distanceThisFrame, collisionMask))
 {
     enabled = false;    
 }
 else
 {
     position += moveThisFrame;
     transform.position = Vector3(position.x, position.y + 0.75, position.z);    
 }

}

Spherical GameObject Script

var questiontrigger: boolean = false; var mover : DroppableMover; var playerStatus : ThirdPersonStatus; var QuestionMark : GameObject;

function Start () { // do we exist in the level or are we instantiated by an enemy dying? mover = GetComponent(DroppableMover); }

function OnTriggerEnter (col: Collider) { if(mover && mover.enabled) return; var playerStatus : ThirdPersonStatus = col.GetComponent(ThirdPersonStatus); Debug.Log("YES"); if(col.gameObject.tag == "Player") questiontrigger = true; print("questiontrigger = true");

 //Destroy(QuestionMark);

}

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

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Bunny83 · Apr 25, 2011 at 12:55 AM

Well, i never used any tutorials or examples like this, but the DroppableMover script is just a script to drop the object it is attached to, to the ground. In the Spherical script, that should be attached to the same object, is the line:

if(mover && mover.enabled) return;

that aborts the OnTriggerEnter function if the object have such a DroppableMover script and the object is not dropped yet. This is done to prevent getting a collision when the object hits the ground during the dropping procedure.

It is not needed in your scripts when you don't use the DroppableMover script along with your script.

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

No one has followed this question yet.

Related Questions

Lerpz Adventure Tutorial - Start Menu 2 Answers

Initialising List array for use in a custom Editor 1 Answer

Make lerpz invisible to enemies by hitting fire 2? A cloak? 1 Answer

3D platformer tutorial problem 1 Answer

Collision with 2 CharacterControllers not precise 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