PDA

View Full Version : The Big Trig Question


elffum
17th Nov 2001, 06:30 PM
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

TaoPaiPai
17th Nov 2001, 06:38 PM
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.

usaar33
17th Nov 2001, 06:42 PM
You are missing something obvious :)

rot=rotator(vector1-vector2);

:cool:

elffum
18th Nov 2001, 06:15 AM
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 :)

TaoPaiPai
18th Nov 2001, 07:24 AM
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.

elffum
18th Nov 2001, 09:19 AM
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!

Captain Kewl
18th Nov 2001, 01:30 PM
I don't think RenderOverlays and PostRenders for non-weapon inventory items are polled. You might want to try putting it in a HUD.

elffum
18th Nov 2001, 05:33 PM
thanks, i've but the postrender() stuff in a mutator and its working (sort of :))

TaoPaiPai
19th Nov 2001, 04:52 AM
Give us a screenshot :)

elffum
19th Nov 2001, 08:51 AM
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 :)

Eater1
24th Nov 2001, 10:36 PM
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.

TaoPaiPai
25th Nov 2001, 11:06 AM
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.

elffum
26th Nov 2001, 12:47 PM
Originally posted by Eater1
[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 :).
Eater. [/B]

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 (http://forums.beyondunreal.com/showthread.php?s=&threadid=93134) 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 :)

eXoR
26th Nov 2001, 12:53 PM
Originally posted by elffum
heres the pick, notice also the smoke coming from the minigun after i fired it another adition of mine :)

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 ?

Eater1
26th Nov 2001, 05:33 PM
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.

elffum
26th Nov 2001, 06:01 PM
Originally posted by eXoR


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 ?

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 :)

TaoPaiPai
26th Nov 2001, 08:00 PM
hey eXor ,they talked about your muti last month in a french videogames magazine :)

eXoR
27th Nov 2001, 08:33 AM
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.