Team Spartan Cookies & Milk Forums
SF Editor Bug + Plane intersection question - Printable Version

+- Team Spartan Cookies & Milk Forums (https://teamscm.co.uk)
+-- Forum: Garry's Mod (https://teamscm.co.uk/forum-4.html)
+--- Forum: Starfall (https://teamscm.co.uk/forum-7.html)
+--- Thread: SF Editor Bug + Plane intersection question (/thread-1382.html)



SF Editor Bug + Plane intersection question - SuperPlayer - 04-10-2015

Hello!

I got a few problems with starfall again. First when i use the new day / night theme change it just changes the theme for half of the editor.
What i mean by that I am changing the the theme from Monokai to Chrome the editors color changes to white but the field where i enter the code keeps the Monokai theme.

Also i am trying to make a plane line intersect function for an emitter. But i keep getting this error:
sv: Player тѕсм.xXxANOxXx [GER] received error: SF:MF_Emitter.txt:73: attempt to call method 'Dot' (a nil value)

The functions I am using:

function Cursor()
LocalPlayer = ents.owner()
local Intersect = PlanLineIntersect( LocalPlayer:eyePos(), LocalPlayer:eyePos() + LocalPlayer:aimVector()*16800, Angles, Bridge:pos() + Bridge:getForward()*-60 + Bridge:getUp()*47 + Bridge:getRight()*190 )

render.setColor(255,0,0,255)
render.drawCircle(Intersect)
end

function PlanLineIntersect( lineStart, lineEnd, planeNormal, planePoint )
if lineStart == nil or lineEnd == nil or planeNormal == nil or planePoint == nil then error("Nil value") end
local t = planeNormalBig Grinot( planePoint - lineStart )/ planeNormalBig Grinot( lineEnd - lineStart )
return lineStart + t * ( lineEnd - lineStart )
end

--In the code Angles is:
Angles = Bridge:ang()
Angles:RotateAroundAxis( Bridge:right(), 90 )
Angles:RotateAroundAxis( Bridge:forward(), 90 )
Angles:RotateAroundAxis( Bridge:up(), 180 )

--And Bridge is:
ents.self:isWeldedTo()

Before that i wanted to use:
util.IntersectRayWithPlane( Vector rayOrigin, Vector rayDirection, Vector planePosition, Vector planeNormal ) 

But this doesnt exists in SF so is there another function like that?


RE: SF Editor Bug + Plane intersection question - TheOneAndOnlyTee - 05-10-2015

Super i'm going to release the function that garbius coded ported to work with Link's button functions soon


RE: SF Editor Bug + Plane intersection question - SuperPlayer - 05-10-2015

(05-10-2015, 12:05 AM)T-17 Wrote: Super i'm going to release the function that garbius coded ported to work with Link's button functions soon

Great! But i still would like to know what I am doing wrong in my code. You know... for learing and so


RE: SF Editor Bug + Plane intersection question - TheOneAndOnlyTee - 05-10-2015

you've taken a different route since Garbius never used planeNormal() so i'm not sure if that'll work


RE: SF Editor Bug + Plane intersection question - Person8880 - 05-10-2015

A "normal" refers to a normalised vector (i.e. a vector whose length is 1). You're passing in an Angle object instead, which is why it's failing. Your normal should be Angles:Up().

As for the theme issue, are you using the correct theme name? It has to be all lowercase, and spaces have to be _ instead, so in your case: "monokai" and "chrome".