- Home /
Lag when I change the layer of a game object ingame
Hi,
I use unity and uscript to create an rpg game like ragnarok online (point&click deplacement and top camera).
Actually I try to find a way to change the collision between an object and a raycast from my mouse cursor.
Imagine a bridge, when my character walk on the top of the bridge, raycast must detect collisions of the bridge gameobject, and when my character walk beneath, raycasthit must not detect collision.
I tried to do this while changing the layer of the gameobject in game (global update detect position of the character, if position > x layer of the bridge = default and if position < x layer of the bridge = ignore raycasthit) but it make me lag really hard (1 frame / 3 sec) and I cant play.
I also tried to active / desactive the component "mesh collider" of the bridge in game with the same way, but it doesnt work, the component is always desactiveted.
Ty for any help and sorry for my bad english.
Your answer
Follow this Question
Related Questions
Assigning a transform using the ray cast collider. 2 Answers
Please help me with Raycast 1 Answer
Hit distance Change light range 1 Answer
Problem with LineCast Bullet 1 Answer