You are viewing our Forum Archives. To view or take place in current topics click here.
Unity - Need help with Raycasting and moveTowards.
Posted:

Unity - Need help with Raycasting and moveTowards.Posted:

BPM
  • V5 Launch
Status: Offline
Joined: Sep 12, 201014Year Member
Posts: 7,232
Reputation Power: 1137
Status: Offline
Joined: Sep 12, 201014Year Member
Posts: 7,232
Reputation Power: 1137
So essentially this is what I want to replicate currently. Exploded view.



At the moment I am trying to attach a rayCast script to to a FP camera and have an object smoothly animate from a 'complete object to an 'explded view' with all the parts going to a target position once clicked.
I have managed to create a script that will move each part to its target position smoothly using Vector3.moveTowards, but it happens automatically. I need it to do it on click. This is where I am having problems. I have no idea how to. When I almost get it working on click, moveTowards doesn't work. Parts just go from point A to point B.

Unable to post code at the moment as I haven't the projects files on me at the moment, but looking for suggestions or maybe Ppseudocode examples. Hopefully trying to get a script setup that I can apply it to many objects and not just the one.

Any help would be appreciated



Last edited by BPM ; edited 1 time in total
#2. Posted:
FourStar
  • Winter 2016
Status: Offline
Joined: Dec 15, 201211Year Member
Posts: 818
Reputation Power: 67
Status: Offline
Joined: Dec 15, 201211Year Member
Posts: 818
Reputation Power: 67
Im not too familiar with Unity as I favour Unreal Engine but if im understanding correctly this could help - [ Register or Signin to view external links. ]

Make sure to post in the Unity Community support forums - [ Register or Signin to view external links. ]
#3. Posted:
BPM
  • Winter 2016
Status: Offline
Joined: Sep 12, 201014Year Member
Posts: 7,232
Reputation Power: 1137
Status: Offline
Joined: Sep 12, 201014Year Member
Posts: 7,232
Reputation Power: 1137
FourStar wrote Im not too familiar with Unity as I favour Unreal Engine but if im understanding correctly this could help - [ Register or Signin to view external links. ]

Make sure to post in the Unity Community support forums - [ Register or Signin to view external links. ]


Thanks but I Should have mentioned Im trying to avoid Animation, pushing for a reuseable script for essentially 'any model'
Jump to:
You are viewing our Forum Archives. To view or take place in current topics click here.