Spawn circle in front of a moving one
4 posts • Page 1 of 1
Spawn circle in front of a moving one
I'm trying to spawn a circle in direct front of another one. Here's an illustration of what I'm trying:
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
- Luka
- Posts: 17
- Joined: Wed Oct 23, 2013 12:57 pm
- Location: pos[0, 0]
Re: Spawn circle in front of a moving one
I think this will work. Increase the 0.1 to increase the space between.
- Code: Select all
_dir := math.atan2(scene.my.p0Vel(1), scene.my.p0Vel(0));
pos := scene.my.p0Pos + [cos(_dir) * (scene.my.p0Radius + 0.1), sin(_dir) * (scene.my.p0Radius + 0.1)]
-
T'wind_ - Posts: 86
- Joined: Wed Jul 08, 2015 5:33 pm
- Location: Western Europe
Re: Spawn circle in front of a moving one
Works wery well. Thanks!
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
- Luka
- Posts: 17
- Joined: Wed Oct 23, 2013 12:57 pm
- Location: pos[0, 0]
Re: Spawn circle in front of a moving one
You can also do it this way. Again change the 0.1 to change the space between.
- Code: Select all
pos := scene.my.p0Pos + [(scene.my.p0Vel(0)*(scene.my.p0Radius + 0.1))/(scene.my.p0Vel(1)^2+scene.my.p0Vel(0)^2)^0.5,(scene.my.p0Vel(1)*(scene.my.p0Radius+0.1))/(scene.my.p0Vel(1)^2+scene.my.p0Vel(0)^2)^0.5]
-
T'wind_ - Posts: 86
- Joined: Wed Jul 08, 2015 5:33 pm
- Location: Western Europe
4 posts • Page 1 of 1
Who is online
Users browsing this forum: No registered users and 7 guests