1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Two Factor Authentication is now available on BeyondUnreal Forums. To configure it, visit your Profile and look for the "Two Step Verification" option on the left side. We can send codes via email (may be slower) or you can set up any TOTP Authenticator app on your phone (Authy, Google Authenticator, etc) to deliver codes. It is highly recommended that you configure this to keep your account safe.

The Big Trig Question

Discussion in 'Programming' started by elffum, Nov 17, 2001.

  1. elffum

    elffum New Member

    Joined:
    Oct 23, 2001
    Messages:
    43
    Likes Received:
    0
    ok, heres my problem, i want to get the rotator between 2 vectors. seems like it should be easy, but the only way i see of doing it is using the dot product. unfortunatly this returns the cosine of the angle between the vectors... which i can't convert to a rotator without an ArcCos function, which UT doesn't seem to provide. am i missing something obvious here? please help! im going to stay up till someone tells me how to do this, so i can carry on with my late night coding session :) now wheres my pepsi max and extra large pizza, sure i left it here somewhere... :)

    Ben
     
  2. TaoPaiPai

    TaoPaiPai Commisaire Van Loc

    Joined:
    Jun 13, 2000
    Messages:
    1,626
    Likes Received:
    0
    I had the same problem ,here's the method I used:
    I created a vector V from point A to point B (vector V=vector b-vector a) then converted it to a rotator R=rotator(V).Afterward I think you have to convert each of the rotation values (p,y,r) to value%65535 to make sure your number is in the correct range.
    Gimme Pizza.
     
  3. usaar33

    usaar33 Un1337

    Joined:
    Mar 25, 2000
    Messages:
    808
    Likes Received:
    0
    You are missing something obvious :)

    rot=rotator(vector1-vector2);

    :cool:
     
  4. elffum

    elffum New Member

    Joined:
    Oct 23, 2001
    Messages:
    43
    Likes Received:
    0
    thanx, got it sorted now, it was, as usual, a really stupid mistake on my part.. Doh! anywayz, heres a pic of what you helped me finish :). Its a (now accurate) Terminator style laser sight mounted on a helmet. i plan on having the helmet as a pickup item with laser sight, night vision, flashlight, zoom, and maybe other things if i think of them, all toggled with a button. which leads me onto my next question... is it possible to draw meshes on the hud like the weapons, or is this all crazy native code for the weapon class?

    heres the pick, notice also the smoke coming from the minigun after i fired it another adition of mine :)
     
  5. TaoPaiPai

    TaoPaiPai Commisaire Van Loc

    Joined:
    Jun 13, 2000
    Messages:
    1,626
    Likes Received:
    0
    Yes you can draw a mesh onto the HUD !

    Use the function canvas.drawActor(actor,someBoolean)

    I don't know the use of someBoolean but it is set to false for weapons.

    I think you have to adjust some of the default properties of your actor to have it render correctly on your display (such as x and y offset variables,first person mesh,etc...I don't know the exact names for these variables,take a look at the code from some weapon)
    I've never tried so don't know if it works.
     
  6. elffum

    elffum New Member

    Joined:
    Oct 23, 2001
    Messages:
    43
    Likes Received:
    0
    arrgggg! this is so frustrating! i've done everything i need to get this working and its not! basicly, ive got an inventory item that i want to display a mesh on the hud. the inventory class has this cabability built in, but i've set all the properties right and it doesn't work, and i've tried overriding the renderoverlays function, still to no effect. if anyone has managed to get this working, please let me know how!
     
  7. Captain Kewl

    Captain Kewl I know kewl.

    Joined:
    Feb 13, 2001
    Messages:
    794
    Likes Received:
    0
    I don't think RenderOverlays and PostRenders for non-weapon inventory items are polled. You might want to try putting it in a HUD.
     
  8. elffum

    elffum New Member

    Joined:
    Oct 23, 2001
    Messages:
    43
    Likes Received:
    0
    thanks, i've but the postrender() stuff in a mutator and its working (sort of :))
     
  9. TaoPaiPai

    TaoPaiPai Commisaire Van Loc

    Joined:
    Jun 13, 2000
    Messages:
    1,626
    Likes Received:
    0
    Give us a screenshot :)
     
  10. elffum

    elffum New Member

    Joined:
    Oct 23, 2001
    Messages:
    43
    Likes Received:
    0
    sorry, i gave up trying :( when i finnally got the mutator to take postrender() calls, the canvas functions would only sort-of work, and canvas.drawactor() wasn't working at all. so i've given up of this funky item idea, and am probably just going to release it as it looks in the first screenshot. check the modsquad beta test forum if you wanna test it for me :)
     
  11. Eater1

    Eater1 Coder

    Joined:
    Oct 22, 2000
    Messages:
    176
    Likes Received:
    0
    OK, about drawing meshes on HUDs, here is how it works:
    The RenderOverlays(...) function in the weapons class positions the weapon in the location where you see it. All that the DrawActor(...) function does is it makes the weapon mesh visible to the player who's canvas calls it (by default its hidden), so all you have to do to have your inventory item get drawn on the HUD is position it in front of the players "eyes" (making sure to make it really close to the viewport/"eyes" and small so that it doesnt intersect with geometry and other actors) and do the DrawActor(...) thing. If you're having trouble positioning it, just copy the RenderOverlays(...) code over from the weapon class. If you're still having trouble, get more pizza, soda, and whatever else helps you think. And no, I'm not just saying that because of my name.

    [EDIT]
    Oh, and now I have a question for you: how did you do that laser? Is it just a bunch of little actors in a line? Are they sprites or meshes? I've been trying for a while to figure out the best way of making lines in UT... thought I might add your technique to my collection :).

    [EDIT]
    Oh, and about that rotator-between-2-vectors... Some people really need to start thinking A LOT LESS. I was reading the thread and wondering when someone would finally figure out the obvious...

    Eater.
     
  12. TaoPaiPai

    TaoPaiPai Commisaire Van Loc

    Joined:
    Jun 13, 2000
    Messages:
    1,626
    Likes Received:
    0
    You know I am intelligent enough to see when you can simplify an algorythm,I was just trying to be explicit so I didn't make the simplification so that elffum can understand the principle of the method used.
    Otherwise I wouldn't have missed rotator (vector-vector) and even if I missed it it wouldn't be such a big deal.
     
  13. elffum

    elffum New Member

    Joined:
    Oct 23, 2001
    Messages:
    43
    Likes Received:
    0
    hehe, its essentially the alt-fire of the pulsegun, but changed beyond all recognition :) it is indeed a line of meshes, using the pbolt mesh that the pulsegun uses, but with a different skin. if you want, check this post, download and check the code out in unreal-ed or something, go on, its not cheating if i give you pemission :) oh, about the rotator thing, i know, im really dumb sometimes :)
     
  14. eXoR

    eXoR Lead coder

    Joined:
    Oct 22, 2001
    Messages:
    36
    Likes Received:
    0
    Sorry for the Off Topic post but eh, I noticed that's my mutator you're running there when taking that screenie :) May I ask what you're planning to do with it ?
     
  15. Eater1

    Eater1 Coder

    Joined:
    Oct 22, 2000
    Messages:
    176
    Likes Received:
    0
    Ah... the pulse gun way... How come I didn't think of that.
    *ducks out of sight before despute between elffum and eXoR regarding intellectual property turns into World War III*

    Eater.
     
  16. elffum

    elffum New Member

    Joined:
    Oct 23, 2001
    Messages:
    43
    Likes Received:
    0
    you mean the bullet time mutator? i was just using it cos its damn fun :)

    btw, i checked out ur site, and the new version of bullet time sounds sweet, are u gonna release it soon? i soooo want to see bullets wizzing past my face in tac-ops :)
     
    Last edited: Nov 26, 2001
  17. TaoPaiPai

    TaoPaiPai Commisaire Van Loc

    Joined:
    Jun 13, 2000
    Messages:
    1,626
    Likes Received:
    0
    hey eXor ,they talked about your muti last month in a french videogames magazine :)
     
  18. eXoR

    eXoR Lead coder

    Joined:
    Oct 22, 2001
    Messages:
    36
    Likes Received:
    0
    Bullet Time in a French mag ? Coool ! Do you by chance have a scanner ? If so, could you please scan the part of the mag that's about Bullet Time for me ? Plzz ?? :)

    Also, version 2.0 has been ready for two weeks or so, but I'm only waiting for the site to finish now and I have to tweak Tactical Ops compatibility because they released a new version that screws everything up :)

    But, I'm working on it. Expect a new version within the next 2 weeks.
     

Share This Page