Author Topic: using custom object as bullet  (Read 7036 times)

0 Members and 1 Guest are viewing this topic.

Offline Flockshot

  • Street Thug
  • *
  • Posts: 29
    • View Profile
using custom object as bullet
« on: September 29, 2014, 06:35:56 pm »
I have an idea to use a custom object as a bullet but there is a problem.

I can make that object and also move it.But the problem is that how do I figure out in which direction to move.
For Example: I used it but i am pointing it a little away from straight but the object goes straight and missing the player.

Can anyone give any idea so that i can move object to where the player points.
I know its possible.

Offline heekz.shadow

  • LU testers
  • Made Man
  • *
  • Posts: 249
    • View Profile
Re: using custom object as bullet
« Reply #1 on: September 29, 2014, 08:06:19 pm »
If you are good with math, it's extremely easy.

You can also search this forum and the unofficial one, it's been answered plenty of times.
Code: [Select]
[20:23] <habi> later only i heard that lu chatbox is customizable. On my first visit, it appeared ugly.
[20:23] <habi> May be that also be the reason why lu has no players

Offline Flockshot

  • Street Thug
  • *
  • Posts: 29
    • View Profile
Re: using custom object as bullet
« Reply #2 on: September 30, 2014, 04:08:04 am »
I am good at math but dont know the equation to be used for it.


and i dont seem to find any on the forum.
« Last Edit: September 30, 2014, 04:16:36 am by Flockshot »

Offline Flockshot

  • Street Thug
  • *
  • Posts: 29
    • View Profile
Re: using custom object as bullet
« Reply #3 on: October 02, 2014, 12:46:14 pm »
Anyone

Offline thijn

  • LU testers
  • VC:MP Veteran
  • *
  • Posts: 667
  • Im proud to be pro.
    • View Profile
    • Vice Underdogs
Re: using custom object as bullet
« Reply #4 on: October 02, 2014, 12:56:32 pm »
Code: [Select]
// [Ka]Juppi's func from http://forum.liberty-unleashed.co.uk/index.php/topic,398.0.html
function GetForwardPoint( pos, angle ) // you must pass an angle in degrees
{
local rad = angle * PI / 180; // we convert to radians
                local x = pos.x, y = pos.y;
local x2 = x + 1.0 * cos(rad) - 25.0 * sin(rad); // we calculate
local y2 = y + 1.0 * sin(rad) + 25.0 * cos(rad);
                return Vector( x2, y2, pos.z ); // return a vector
}

Object.MoveTo( GetForwardPoint( player.Pos, player.Angle ) )

Not tested, but it should give you an idea.

Offline Flockshot

  • Street Thug
  • *
  • Posts: 29
    • View Profile
Re: using custom object as bullet
« Reply #5 on: October 02, 2014, 04:07:29 pm »
Code: [Select]
// [Ka]Juppi's func from http://forum.liberty-unleashed.co.uk/index.php/topic,398.0.html
function GetForwardPoint( pos, angle ) // you must pass an angle in degrees
{
local rad = angle * PI / 180; // we convert to radians
                local x = pos.x, y = pos.y;
local x2 = x + 1.0 * cos(rad) - 25.0 * sin(rad); // we calculate
local y2 = y + 1.0 * sin(rad) + 25.0 * cos(rad);
                return Vector( x2, y2, pos.z ); // return a vector
}

Object.MoveTo( GetForwardPoint( player.Pos, player.Angle ) )

Not tested, but it should give you an idea.

That just move the object in only 1 place no matter what the angle is.
About u saying that it can give me idea i cant understand it.

I dont know about PI,cos,sin i am just in class 8 and it haven't been taught to us.

Offline thijn

  • LU testers
  • VC:MP Veteran
  • *
  • Posts: 667
  • Im proud to be pro.
    • View Profile
    • Vice Underdogs
Re: using custom object as bullet
« Reply #6 on: October 02, 2014, 08:04:32 pm »
Then it's probably a good idea to find something else to do.

Offline Flockshot

  • Street Thug
  • *
  • Posts: 29
    • View Profile
Re: using custom object as bullet
« Reply #7 on: October 03, 2014, 05:14:08 am »
If i remember correctly there was a ramp function in your,stormues test server that make a ramp in front of player
Is it possible to give me that.

Offline thijn

  • LU testers
  • VC:MP Veteran
  • *
  • Posts: 667
  • Im proud to be pro.
    • View Profile
    • Vice Underdogs
Re: using custom object as bullet
« Reply #8 on: October 03, 2014, 05:58:22 pm »
That's the code I posted.

Offline Flockshot

  • Street Thug
  • *
  • Posts: 29
    • View Profile
Re: using custom object as bullet
« Reply #9 on: October 03, 2014, 06:06:42 pm »
That's the code I posted.
Then that code should work.