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
-3
Question by Dreatix · Jun 20, 2012 at 11:11 AM · physicsfpscontrollerpickup

Unity3D HELP! How can i pickup/hold/throw object when im rolling ball?

Hi,im making game where i need to roll ball,i've already have done that,but i need to pickup/hold and throw objects when im rolling ball,im looking for a separate script. Anyway i already tried something,but when i pickup object and roll ball the object fallows ball rotation,object is circling with the ball,through terrain and everything -wtf? Please give me script to do this.

Player is the Ball,remember that.

Comment
Add comment · Show 4
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 Fattie · Jun 20, 2012 at 11:26 AM 2
Share

in your title " im " needs an apostrophe, like this ..

I'm

would you be able to click "edit" and change it? Thanks!

avatar image bubblegumsoldier · Jun 20, 2012 at 11:28 AM 0
Share

wait a $$anonymous$$ute please

avatar image Fattie · Jun 20, 2012 at 11:54 AM 0
Share

O$$anonymous$$, I waited a $$anonymous$$ute, RIGHT NEXT TO where you clicked "Comment", if you just click "edit", you can then edit your headline! Then just click save.

See where you typed "Please give me script to do this." ...

look just UNDER that and to the LEFT you will see the edit button.

you can then click edit and fix the apostrophe in your headline.

avatar image Dreatix · Jun 20, 2012 at 12:00 PM 0
Share

Player is the ball that script is not working,which is underground not working.

4 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by ivomarel · Jun 20, 2012 at 11:26 AM

The ball is probably the parent of your object. You should check the Hierarchy Window and make sure the two objects are not parenting one another. There's no script to fix this - instead, please read some Unity basic tutorials.

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 Dreatix · Jun 20, 2012 at 11:29 AM 0
Share

thats not problem,i just need script to do what i wrote here.

avatar image
0

Answer by bubblegumsoldier · Jun 20, 2012 at 11:50 AM

so it is quite easy you should just do something like this:

var Player :GameObject; //your Player

var minimumDistance :float; //how near your player has to be at the ball

var PickUpPoint :Transform; //where the ball has to go after picking up (should be a child object of the player)

var hasMouseDown :boolean = false;

var isPickedUp :boolean = false;

function OnMouseOver(){

if(Vector3.Distance(transform.position, Player.transform.position) <= minimumDistance){

if(hasMouseDown){

isPickedUp = true;

}

}

}

function Update(){

if(Input.GetButtonDown("Fire1")){

hasMouseDown = true;

}/*else{

hasMouseDown = false;

}*/

if(Input.GetButtonUp("Fire1")){

hasMouseDown = false;

}

if(hasMouseDown == false){

isPickedUp = false;

}

if(isPickedUp){

this.rigidbody.useGravity = false;

transform.position = PickUpPoint.position;

}else{

this.rigidbody.useGravity = true;

}

}

Comment
Add comment · Show 2 · 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 Dreatix · Jun 20, 2012 at 12:01 PM 0
Share

Player is the ball :D and script is not working ;(

avatar image bubblegumsoldier · Jun 20, 2012 at 12:15 PM 0
Share

ohhh now I get what you want

avatar image
0

Answer by bubblegumsoldier · Jun 20, 2012 at 12:19 PM

so you should grad this script on the PickUpPoint (!!!It may not be a child object of the player!!!): var Player :Transform;

var distance_x :float;

var distance_y :float;

var distance_z :float;

function Update (){

transform.position.x = Player.position.x + distance_x;

transform.position.y = Player.position.y + distance_y;

transform.position.z = Player.position.z + distance_z;

transform.rotation.x = Player.rotation.x;

transform.rotation.y = Player.rotation.y;

}

Comment
Add comment · Show 2 · 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 bubblegumsoldier · Jun 20, 2012 at 03:51 PM 0
Share

did it work

avatar image bubblegumsoldier · Jul 12, 2012 at 03:10 PM 0
Share

hello? did this work?

avatar image
0

Answer by Rheeenz! · Jan 04, 2013 at 03:15 PM

Maybe this script didn't work?

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

6 People are following this question.

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

Related Questions

The name 'Joystick' does not denote a valid type ('not found') 2 Answers

Unity3D HELP!!!!!!!!!!!!!!!!!!!!!! : How can i make physics controller jump/PLAY SOUND. 1 Answer

Making the gun model point to the middle screen 1 Answer

Swapping Weapons In Game 0 Answers

Quake like movement 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