hi
i need anyone help me
please
i have items ( radio ) i need the player Fps to pick up …i searched many website and tutorial nothing found
…
what i want i need steps by steps how i make my player pick up any items
thanks alot
support unity3d ![]()
hi
i need anyone help me
please
i have items ( radio ) i need the player Fps to pick up …i searched many website and tutorial nothing found
…
what i want i need steps by steps how i make my player pick up any items
thanks alot
support unity3d ![]()
You need to detect a collision with the item so you need to give it a tag. Click on the Tag drop down menu and at the bottom of the menu select Add Tag.
Then you see the Tag Manager. In the next available element slot, add a tag that will identify your item. Press enter. Then reselect your object that you want to pick up in the Hierarchy panel and choose the tag you defined for it from the tag drop down menu.
Next add a capsule collider to the item you want to collect so the player can interact with it. If a capsule collider doesn’t fit, try a different kind. Set its collider to trigger mode–that is select the box to the right of Is Trigger.
Then you have to add script to your player character to destroy that object and collect it. What sort of script do you have now?
What are you doing with the item you want the player to collect? Do you have an inventory?
A rough script on your player under function Update(){
}
would be—
function OnTriggerEnter(collisionInfo : Collider){
if(collisionInfo.gameObject.tag == “yourtag”){
dosomething();
//where dosomething() is what you want to happen to the object whether add it to inventory or something else
Destroy(collisionInfo.gameObject);
//get rid of the object in the scene
}
}
that’s rough-----