+ Reply to Thread
Results 1 to 9 of 9

Thread: Alarei Telekinetic Applications Glove

  1. #1
    Wiremod Helper Lyinginbedmon's Avatar
    Join Date
    Mar 2009
    Location
    England
    Posts
    2,659

    Default Alarei Telekinetic Applications Glove

    This is something I finished for the most part yesterday whilst messing around, and decided to complete today by adding an additional two states (Push & Pull).
    Basically, this produces a holographic hand that can be used to manipulate an input entity in one of four ways.
    1. Positioning - You can lock it in place relative to the hand, apply velocity to it, and by altering the Dif input you can also fine tune it's location
    2. Rotation - You can precisely orient the entity, both singularly and relative to the hand
    3. Push - You can push the entity away from the hand, or push the hand away from it (Provided the hand is parented to a Palm entity)
    4. Pull - Basically the reverse of Push
    I initially put it together because I had trouble making prop-based hands in the scale I needed, but holograms don't have the necessary physics, this therefore is a way of achieving both and also allowing for significant versatility of use.

    There is a built-in comment Manual at the beginning of the code, if you have any issues let me know.[highlight=e2]@name Holo apply glove

    #Universal inputs
    @inputs State [Entity Palm]:entity LR Posi:vector
    #State inputs
    @inputs LockA Ang:angle
    @inputs LockP Dif:vector Vel
    @inputs Pull
    @inputs Push

    #Functional persists
    @persist [Pos Sca Angle Mod Par]:array H Mat:string Start
    @persist An:angle M [Knucs Offs]:array SetF
    @persist [V Col]:vector A:angle Core:entity Pa Get:array Seq

    ##MANUAL##
    #Input 1 into LR for a Right hand, -1 for a Left hand
    #Unless a Posi vector is input, the glove will attach to Palm

    #State 1 - Positioning
    #Flip LockP to freeze the entity relative to the glove
    #Input a Dif to move it in a given direction on grabbing
    #Vel adds the Dif each tick for sustained velocity
    #State 2 - Angling
    #Flip LockA to freeze the entity's rotational movement
    #Input Ang to rotate the entity to a desired angle
    #LockA overrides Ang if both are input
    #State 3 - Pulling
    #Input 1 into Push to pull Palm towards Entity
    #Input -1 into Push to pull Entity towards Palm
    #Requires a Palm entity
    #State 4 - Pushing
    #Input 1 into Push to shove Palm away from Entity
    #Input -1 into Push to shove Entity away from Palm
    #Requires a Palm entity

    if(first()){
    PosushVector(vec()) ScaushVector(vec(0.5,0.417,0.333)) AngleushAngle(ang()) ModushString("hqtorus2") ParushNumber(1)
    PosushVector(vec()) ScaushVector(vec(0.417,0.417,0.10)) AngleushAngle(ang()) ModushString("hqicosphere2") ParushNumber(1)
    PosushVector(vec(0,2*LR,-0.5)) ScaushVector(vec(0.249,0.249,0.124)) AngleushAngle(ang()) ModushString("hqicosphere2") ParushNumber(1)
    PosushVector(vec(0,0,-0.143)) ScaushVector(vec(0.457,0.457,0.124)) AngleushAngle(ang(180,0,0)) ModushString("dome2") ParushNumber(1)
    PosushVector(vec(0,3*LR,-0.5)) ScaushVector(vec(0.083,0.083,0.083)) AngleushAngle(ang()) ModushString("hqicosphere2") ParushNumber(4)
    PosushVector(vec(1,3*LR,-0.5)) ScaushVector(vec(0.167,0.167,0.333)) AngleushAngle(ang(90,0,0)) ModushString("hqcylinder") ParushNumber(5)
    PosushVector(vec(2,-2*LR,0)) ScaushVector(vec(0.083,0.083,0.083)) AngleushAngle(ang()) ModushString("hqicosphere2") ParushNumber(1)
    PosushVector(vec(3,-2*LR,0)) ScaushVector(vec(0.167,0.167,0.333)) AngleushAngle(ang(90,0,0)) ModushString("hqcylinder") ParushNumber(7)
    PosushVector(vec(5,-2*LR,0)) ScaushVector(vec(0.083,0.083,0.083)) AngleushAngle(ang()) ModushString("hqicosphere2") ParushNumber(8)
    PosushVector(vec(6,-2*LR,0)) ScaushVector(vec(0.167,0.167,0.333)) AngleushAngle(ang(90,0,0)) ModushString("hqcylinder") ParushNumber(9)
    PosushVector(vec(3,LR,0)) ScaushVector(vec(0.083,0.083,0.083)) AngleushAngle(ang()) ModushString("hqicosphere2") ParushNumber(1)
    PosushVector(vec(4,LR,0)) ScaushVector(vec(0.167,0.167,0.333)) AngleushAngle(ang(90,0,0)) ModushString("hqcylinder") ParushNumber(11)
    PosushVector(vec(6,LR,0)) ScaushVector(vec(0.083,0.083,0.083)) AngleushAngle(ang()) ModushString("hqicosphere2") ParushNumber(12)
    PosushVector(vec(7,LR,0)) ScaushVector(vec(0.167,0.167,0.333)) AngleushAngle(ang(90,0,0)) ModushString("hqcylinder") ParushNumber(13)
    H=1
    Mat="models/combine_scanner/scanner_eye"
    }
    if(Pos:count()){interval(1000)}
    else{runOnTick(1)}
    if(!Start){
    N=0
    while(N<=10 & Pos:count()){
    P=entity():toWorld(vec(0,0,30))+Pos[1,vector]
    S=Sca[1,vector]
    A=Angle[1,angle]
    Mo=Mod[1,string]
    Pa=Par[1,number]

    holoCreate(H,P,S,A)
    holoModel(H,Mo)
    holoParent(H,Pa)

    H++,N++
    Pos:remove(1)
    Sca:remove(1)
    Angle:remove(1)
    Mod:remove(1)
    Par:remove(1)
    if(!Pos:count() & !Seq){
    H=1
    Seq++
    }
    }
    if(Seq==1){
    GM=holoEntity(14):getMaterial()
    while(Seq==1 & GM!=Mat & N<=10){
    holoMaterial(H,Mat)
    H++,N++
    }
    if(GM==Mat){
    Seq++
    Core=holoEntity(2)
    Get=Palm:getConstraints()
    M+=Palm:mass()*0.9
    }
    }
    elseif(Seq==2){
    if(Get:count()){
    N=0
    while(Get:count() & N<=10){
    M+=Get[1,entity]:mass()*0.9
    N++
    }
    }
    else{
    Start++

    KnucsushNumber(5) OffsushAngle(-ang(12,-9,0))
    KnucsushNumber(7) OffsushAngle(-ang(12,0,0))
    KnucsushNumber(9) OffsushAngle(ang())
    KnucsushNumber(11) OffsushAngle(-ang(12,0,0))
    KnucsushNumber(13) OffsushAngle(ang())
    }
    }
    }
    Pa=(Palm ? 1 : 0)
    if(LR & $LR|Pa & $Pa){reset()}

    if(Start){
    #Core element
    holoMaterial(2,(State ? "models/props_combine/tpballglow" : ""))
    Col=Core:getColor()
    if($Col){
    Core:soundPlay(1,1,"buttons/button9.wav")
    }

    if(Posi){
    holoPos(1,Posi)
    holoUnparent(1)
    }
    elseif($Start){
    E=(Palm ? Palm : entity())
    Vec=E:toWorld(E:boxCenter())
    holoPos(1,Vec+vec(0,0,10)*!Palm)
    holoAng(1,E:angles())
    holoParent(1,E)
    }
    #Hand angling
    if(Entity & !Palm & !(LockA|LockP)){
    Ve=Entityos()
    Ve-=holoEntity(1)os()
    holoAng(1,Ve:toAngle()-ang(22.5,0,0))
    }
    Box=Entity:toWorld(Entity:boxCenter())

    #Digit angling
    Y=Core:angles():yaw()
    N=0
    while(N<=Knucs:count()){
    H=Knucs[N,number]
    Hol=holoEntity(H)
    Vec=Box-Holos()
    A=Vec:toAngle():setYaw(Y)
    A+=Offs[N,angle]
    holoAng(H,(Entity ? A : Core:angles()))
    N++
    }

    ##Locking
    #Relative locking mechanism
    LP=LockP & $LockP & State==1
    #Positional locking
    if(LP & !SetF){
    V=Core:toLocal(Box)
    V+=Dif
    SetF=1
    }
    elseif(!LockP){
    V=Core:toLocal(Box+Entity:vel()/(Entity:mass()*2))
    SetF=0
    }
    #Angular locking
    if(LockA & Entity & $LockA|!LockA){
    A=Entity:angles()
    }

    Mass=Entity:mass() VelW=Entity:vel()

    if(State==1){ #Positioning
    holoColor(2,vec(0,0,1)*255)

    V+=Dif*Vel #Application of applied velocity
    Des=Core:toWorld(V)

    Vec=Des-Box
    Vec*=Entity:mass()
    Vec-=VelW/2

    Entity:applyForce(Vec*Mass)
    }
    elseif(State==2){ #Angling
    holoColor(2,vec(0,1,0)*255)

    Ine=Entity:inertia() AVel=Entity:angVelVector()
    Angs=Entity:angles() Mass=Entity:mass()

    Ag=(LockA ? A : Ang) Ag=(!LockA & Ang ? Ang : Angs)

    Q1=quat(Entity)
    Q2=quat(Ag)
    Q=Q2/Q1

    Torq=Entity:toLocal(rotationVector(Q)+Box)*Mass^2
    Torq-=AVel*Mass
    Torq*Ine

    Entity:applyTorque(Torq)
    }
    elseif(State==3){ #Pulling
    holoColor(2,vec(0,1,1)*255)
    Vec=Box-Coreos()

    if(Pull>0){ #Pull Palm towards
    Vec*=M
    Vec-=Palm:vel()

    Palm:applyForce(Vec)
    }
    elseif(Pull<0){ #Pull Entity towards
    Vec*=-1
    Vec*=Entity:mass()
    Vec-=Entity:vel()

    Entity:applyForce(Vec)
    }
    }
    elseif(State==4){ #Pushing
    holoColor(2,vec(1,0,0)*255)
    Vec=Box-Coreos()

    if(Push>0){ #Push Palm away
    Vec*=-1
    Vec*=M
    Vec-=Palm:vel()

    Palm:applyForce(Vec)
    }
    elseif(Push<0){ #Push Entity away
    Vec*=Entity:mass()
    Vec-=Entity:vel()

    Entity:applyForce(Vec)
    }
    }
    else{
    holoColor(2,vec(1,1,1)*255)
    }
    }[/highlight]

    The Olympus Technologies drones, totally not SkyNet in Gmod form.
    Cronus: The Ultimate Drone, definitely SkyNet in Gmod form.
    The gBrain Project, the drone controls system that thinks it's better than you

  2. #2
    Wire Sofaking Unsmart's Avatar
    Join Date
    Dec 2008
    Location
    Belgium OR BANland
    Posts
    1,965

    Default Re: Alarei Telekinetic Applications Glove

    This looks cool! Ill give it a try tomorrow!
    New server IP: 89.238.160.17:27018
    Hologram contraptions 1 Holo contraptions 2 EGP stuff Holo minigun Holo javelin rocket launcher
    Unsmart: I doubt the intelligence of some people.
    Drunkie: Nobody could have said that any better than Unsmart.

    Unsmart: Solece, I totally did your mom yesterday
    Solece: Who hasnt

    Divran: there are more retarded people than there are clever people in this world

  3. #3
    http://somone77.net somone77's Avatar
    Join Date
    Jun 2008
    Location
    <Smart ass location>
    Posts
    614

    Default Re: Alarei Telekinetic Applications Glove

    The force is strong in this one.


    No matter how many Z's you put after Plz, you still spell as well as a piece of cheese.

    http://somone77.net

  4. #4
    Wire Sofaking vexx21322's Avatar
    Join Date
    Dec 2008
    Location
    Co, united states
    Posts
    424

    Default Re: Alarei Telekinetic Applications Glove

    Can you upload the .txt, that bbcode isn't good for copying.
    Have you checked HERE first?

  5. #5
    No u Divran's Avatar
    Join Date
    Jul 2008
    Location
    Sweden
    Posts
    4,582

    Default Re: Alarei Telekinetic Applications Glove

    Quote Originally Posted by vexx21322 View Post
    Can you upload the .txt, that bbcode isn't good for copying.
    Click reply with quote and copy.
    SVN Tutorial
    My SVN:
    Code:
    http://divranspack.googlecode.com/svn/trunk/%20divranspack/
    Get dropbox and get 250 MB extra space: Dropbox

  6. #6
    ส็็็็็็็็็็็็็็็็ส็็ ็็็็็ Dav1d's Avatar
    Join Date
    May 2009
    Posts
    1,118

    Default Re: Alarei Telekinetic Applications Glove

    @divran
    It's too big to copy all in one.

  7. #7
    Wire Sofaking Ramishen's Avatar
    Join Date
    Jul 2007
    Location
    Where I live
    Posts
    419

    Default Re: Alarei Telekinetic Applications Glove

    This help? Just copied it into a text file for those who couldn't for whatever reason.
    I'm having alot of fun with this btw!
    Attached Files Attached Files
    Quote Originally Posted by Schilcote View Post
    Do what I say, then tell me what happens.

  8. #8
    No u Divran's Avatar
    Join Date
    Jul 2008
    Location
    Sweden
    Posts
    4,582

    Default Re: Alarei Telekinetic Applications Glove

    Quote Originally Posted by Dav1d View Post
    @divran
    It's too big to copy all in one.
    What? Dumbest statement of the day. Last time I checked, I could copy 200 A4 pages without a problem.
    SVN Tutorial
    My SVN:
    Code:
    http://divranspack.googlecode.com/svn/trunk/%20divranspack/
    Get dropbox and get 250 MB extra space: Dropbox

  9. #9
    Wiremod Helper Lyinginbedmon's Avatar
    Join Date
    Mar 2009
    Location
    England
    Posts
    2,659

    Default Re: Alarei Telekinetic Applications Glove

    Quote Originally Posted by Ramishen View Post
    This help? Just copied it into a text file for those who couldn't for whatever reason.
    I'm having alot of fun with this btw!
    Good to hear. It's a pretty simple thing really, most of the work was fine tuning the math and organising the holograms, but it's pretty (no pun intended) handy to have around.

    The Olympus Technologies drones, totally not SkyNet in Gmod form.
    Cronus: The Ultimate Drone, definitely SkyNet in Gmod form.
    The gBrain Project, the drone controls system that thinks it's better than you

+ Reply to Thread

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