+ Reply to Thread
Page 2 of 2 FirstFirst 12
Results 11 to 15 of 15

Thread: E2 chip and camera help

  1. #11
    Wirererer crichards's Avatar
    Join Date
    Aug 2010
    Location
    NC
    Posts
    293

    Default Re: E2 chip and camera help

    You can wire "Activated", in the inputs of the cam controller, to "Active", in the outputs of the adv. pod controller. You need to wire in "Direction" and "Position" of something relative to the driver as well, such as the Pod itself.

    Code:
    if(first())
    
    {
    CurTargetPos=vec(0,0,0)
    OldTargetPos=TargetPos
    Dist=0
    }
    I am, by no means, an E2 wizard so I can't tell you exactly why I would do this, but I would get rid of the if statuement and place the two vectors and the normal outside of the brackets. I have a policy for myself and that is to only use if(first()) for values that don't change. I do however, realize you're trying to set those values when you spawn the chip. I'm not sure, but I don't think you need to.

    I read this back to myself and see how ignorant this response is. I'm probably not the most efficient E2 maker.
    Last edited by crichards; 09-01-2010 at 02:02 PM. Reason: Half of the post was in [code] tags

  2. #12
    Wire Noob Soundlogic's Avatar
    Join Date
    Aug 2010
    Posts
    24

    Default Re: E2 chip and camera help

    That code is setting the defaults of the variables, and having the cam controller only trigger when someone is in the pod WON'T HELP. The problem is I can't make it so it controls the camera of the player in the pod BUT NOT MINE. If I wire it as you suggest, a player would get in the pod, and MY camera would be messed up.

  3. #13
    Wirererer Grissess's Avatar
    Join Date
    Aug 2009
    Location
    On top of your call stack
    Posts
    161

    Default Re: E2 chip and camera help

    Huh...I see what you're getting at. Frankly, I didn't know a cam controller was even capable of controlling another player's camera; I'd always used them for covert purposes (where I'd be the only user).

    I've read the lua for the cam controller. These lines (in ENT:TriggerInput, if the input is "Activated") are likely what are suspect:

    Code:
    				if self.CamPod:GetDriver() and self.CamPod:GetDriver():IsValid() then
    					self.CamPlayer = self.CamPod:GetDriver()
    The code further sets the view entity of that player to a camera ent (gmod_wire_cam), which does the dirty work of positioning, parenting, angling, etc. So, you are correct, and by triggering Activate AS SOON AS another player enters the Pod, it will work; BUT, you should note that it only updates EXACTLY WHEN the Activated input changes. If you want it to update dynamically based on who enters and leaves the Pod, I recommend setting up a simple circuit consisting of a Gate - Time Pulser and a Gate - Memory toggle, so that Activated changes between 1 and 2, but the following E2 would work just as well:

    Code:
    @name Pulser
    @outputs Out
    
    if(first()) {
        runOnTick(1)
    }
    
    if(Out==1) {
        Out=2
    } else {
        Out=1
    }
    As for why E2 isn't working, I still have no clue; I recommend completely deleting everything in your wire folders and redownloading them; I once had a problem with stale files corrupting my wire install.

  4. #14
    Wirererer crichards's Avatar
    Join Date
    Aug 2010
    Location
    NC
    Posts
    293

    Default Re: E2 chip and camera help

    Read my first paragraph again.

    "You need to wire in "Direction" and "Position" of something relative to the driver as well, such as the Pod itself."

    Code:
    @inputs Cam:wirelink
    
    Cam:setVector("Direction", Pod:forward())
    Cam:setVector("Position", vec(0, -150, 0)
    This sets the cameras position 150 units behind your pod, pointing forward. Your code is overcomplicated and doesn't make sense to me. As long as you wire Activated on the cam controller to Active on the pod controller, you should get the results you want. People use my vehicles all the time in MP.

    By the way, what is Player2:wirelink? Is it wired to the pod? And are you trying to mouse aim the cam? If so you need an eye pod, otherwise it makes more sense to parent the cam to something like the pod and control the pod instead.
    If your code is instructions for the cam (I can't even tell), then replace everything with the above code. Something you coded is controlling only your cam.

  5. #15
    aka Colonel Never Online Colonel Thirty Two's Avatar
    Join Date
    Oct 2009
    Posts
    2,683
    Blog Entries
    5

    Default Re: E2 chip and camera help

    Quote Originally Posted by crichards View Post
    Code:
    @inputs Cam:wirelink
    
    Cam:setVector("Direction", Pod:forward())
    Cam:setVector("Position", vec(0, -150, 0)
    Depreciated code is depreciated.
    Code:
    @inputs Cam:wirelink
    
    Cam["Direction",vector] = Pod:forward()
    Cam["Position",vector] = vec(0,-150,0)

+ Reply to Thread
Page 2 of 2 FirstFirst 12

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
proceed-collector
proceed-collector
proceed-collector
proceed-collector
linguistic-parrots
linguistic-parrots
linguistic-parrots
linguistic-parrots