Welcome to the new Diaspora forums, please let us know if you see anything broken! Notice: Some users may need to reupload their avatars due to an issue during forum setup!
360 arc panning ship view
This chip is easy to install on a ship with a gyropod. You wirelink it to your advance pod controller and then to your gyro, and get in. It allows you to zoom in and out with the mouse wheel, and is handy on ships of all sizes. Very little coding is required to get it operational. You will have to set the Minzoom and Maxzoom at the top to a good size.
Update 1.0.3
You now have an Override variable that will let you bypass the automatic ship scan and let you place your own values for min and max zoom. You can link a gyro to it and it will always default to that as the center. If you don't it will use the e2 if override is enabled, and it will act like it has been if it is disabled. The code now uses a modded version of steeveeo's parenting e2 steps so that larger ships don't error out. I wrote this all in the post so I don't know if there are any errors.
Update 1.0.4
Smarter auto-center finding. It now excludes smaller wire props, so it should get a more accurate center. Cleaner gyro input detection as well. Uses the yield command to see if there is an input
Update 1.0.3
You now have an Override variable that will let you bypass the automatic ship scan and let you place your own values for min and max zoom. You can link a gyro to it and it will always default to that as the center. If you don't it will use the e2 if override is enabled, and it will act like it has been if it is disabled. The code now uses a modded version of steeveeo's parenting e2 steps so that larger ships don't error out. I wrote this all in the post so I don't know if there are any errors.
Update 1.0.4
Smarter auto-center finding. It now excludes smaller wire props, so it should get a more accurate center. Cleaner gyro input detection as well. Uses the yield command to see if there is an input
@name External panning camera @inputs [Apc Gyro]:wirelink @persist Zoom Minzoom Maxzoom Zoomrate Override End Step @persist [Center Min Max Total]:vector @persist Bear Elev Active Count @persist [Driver, Dump]:entity @persist [Ship]:array #By Katelyn #AIM: Consta135 #E-mail: Katelyn135@gmail.com #Version 1.0.4 interval(50) if (first() | dupefinished()) { #Override lets you set the zoom values yourself. #If you have problems try enabling this. Set it to one to override Override = 0 Count = 0 if (Override) { #Edit these if you have override enabled. Minzoom = 100 Maxzoom = Minzoom * 10 Center = (->Gyro ? entity():pos() - Gyro:entity():pos() : vec()) Zoom = Minzoom Zoomrate = Maxzoom / 5 End = 1 } else { timer("First",100) Ship = entity():getConstraints() Min = entity():pos() Max = Min Total = vec() } rangerDefaultZero(0) rangerIgnoreWorld(0) rangerHitWater(1) rangerHitEntities(1) rangerFilter(entity():getConstraints()) rangerPersist(1) } if(clk("First")) { Index = 1+(10*Step) End = 0 while(Index <= 10+(10*Step)) { if(Index != Ship:count()+1) { if (Ship[Index, entity]:volume() >= 10000) { K = Ship[Index, entity]:aabbMin() + Ship[Index, entity]:pos() Min = min(Min, K) K = Ship[Index, entity]:aabbMax() + Ship[Index, entity]:pos() Max = max(Max, K) Total = Ship[Index, entity]:pos() + Total Count++ } if (Ship[Index, entity]:type() == "gmod_wire_adv_pod") { Apc = Ship[Index, entity]:getWirelink() print("Linked") } Index++ } else { Minzoom = Max:distance(Min) / 3 Maxzoom = Minzoom * 10 Center = (->Gyro ? entity():pos() - Gyro:entity():pos() : entity():pos() - (Total / Count)) Zoom = Minzoom Zoomrate = Maxzoom / 5 End = 1 break } } if(!End) { Step++ timer("First",100) } } if (End) { Driver = Apc["Entity", entity] Zoom = Zoom + ((Apc["NextWeapon", number] - Apc["PrevWeapon", number]) * Zoomrate) Zoom = clamp(Zoom, Minzoom, Maxzoom) Active = (Zoom != Minzoom & Apc["Active", number] ? 1 : 0) #Bear = Driver:eyeAngles():yaw() #Elev = Driver:eyeAngles():pitch() + 90 Bear = Apc["Bearing", number] - 180 Elev = Apc["Elevation", number] - 90 X = Zoom * cos(Bear) * sin(Elev) Y = Zoom * sin(Bear) * sin(Elev) Z = Zoom * cos(Elev) if (Apc["Active", number]) { Bear = Apc["Bearing", number] Elev = -Apc["Elevation", number] + 90 Pos = entity():pos() - Center #Ranger = rangerOffset(Zoom + 50, Pos, Pos - vec(X, Y, Z)) Driver:setView(Active, Pos - vec(X, Y, Z), ang(Elev - 90, Bear, 0)) #[ if ((Gyro:entity():pos() - vec(X, Y, Z)):isInWorld()) { Driver:setView(Active, Gyro:entity():pos() - vec(X, Y, Z), ang(Elev - 90, Bear, 0)) } else { Ranger = rangerOffset(Gyro:entity():pos(), Gyro:entity():pos() - vec(X, Y, Z)) Driver:setView(Active, Ranger:position(), ang(Elev - 90, Bear, 0)) } ]# } if (changed(Driver:driver())) { Zoom = Minzoom Dump:setView(0, vec(), ang()) Dump = Driver } #x = r * cos(s) * sin(t) #y = r * sin(s) * sin(t) #z = r * cos(t) }
Comments
This version is already very good,there are few ways to make it better.
Also another suggestion would be to detect if ship is inside a planets atmosphere,and if it is don't let your camera zoom out the atmosphere which stops you seeing your ship.
Atmosphere detection is not too far fetched,but the checking planet radius might be.
-Wireless addition
--You can just apply the chip to your ship and it is done.
--It auto-detects am advanced pod controller and uses it. Multiple pod controllers will be a problem, but most ships don't have them. Next version will support overriding the auto-detect.
--It auto-finds the center of your ship and adjusts the zoom.
Expression 2 (External panning camera): entities/gmod_wire_expression2/core/vector.lua:145: attempt to index local 'rv1' (a nil value)
Any Ideas?