Open Surge Forum

A fun 2D retro platformer inspired by Sonic games and a game creation system

You are not logged in.

Announcement

Our community has moved to Discord! https://discord.gg/w8JqM7m

#1 2011-02-09 15:54:42

ssdw
Member
From: Holland
Registered: 2010-05-23
Posts: 508
Website

Rad and Deg

I've been a while to play with tangent (for the tree object).
I always got a different answer on my calculator.
I just found out that the tangent is given in rad and not in deg.
on the wiki I found the command "rad2deg()", but the answer is totally different!
I have tested it with this object:

    object "tan"
    {
        state "main"
        {
            let "$x = rad2deg(tan(1))" //deg 
            let "$y = tan(1)" //rad
            textout default 0 000 "<color=ffff00>Deg_tan(1)= $x</color>"
            textout default 0 -25 "<color=ffff00>Rad_tan(1)= $y</color>"
        }
    }

the game answers are:
in deg: 89,23289
in rad: 1,55741

The calculator answers are:
in deg: 0,017455064
in rad: 1,556407725


getforumpic.php

Offline

#2 2011-02-09 16:01:09

Alexandre
Administrator
From: Brazil
Registered: 2009-01-27
Posts: 3,300
Website

Re: Rad and Deg

does this problem happen if, instead of using tan(1), you use sin(1)/cos(1) in the game?

edit: wait... now I looked better at your code and you're using rad2deg on the tangent. It's not going to work.
try tan(deg2rad(1))

Last edited by Alexandre (2011-02-09 16:05:16)

Offline

#3 2011-02-09 16:14:45

ssdw
Member
From: Holland
Registered: 2010-05-23
Posts: 508
Website

Re: Rad and Deg

I had not thought of that, thanks.
sorry for this topic neutral


getforumpic.php

Offline

#4 2011-02-09 16:28:41

Alexandre
Administrator
From: Brazil
Registered: 2009-01-27
Posts: 3,300
Website

Re: Rad and Deg

ssdw wrote:

I had not thought of that, thanks.
sorry for this topic

please feel free to ask when you have any questions

Offline

Board footer

Powered by FluxBB  hosted by tuxfamily.org