![]() |
attachplayertoobj vehicles
Hello everyone,
Just recently I decided to attempt to fabricate a vehicle that more than one player may enter, and ride around in. I have gotten the ganis to correctly show, and the setshape2s to work, but the one thing I am having problems with is the adjusting of the player's x and y when the vehicle turns. My question to you is, is there a general equation for updating the player's x and y based on the direction of the vehicle? If so, would you mind helping me to figure out what that equation is? All help is much appreciated. |
it depends on the width of the car as well. what excatly happens when you make a turn? where do both players end up? excatly what is your current equation. I have already made a multi person vehicle on bravo so i'd be more than glad to help if i knew more about your current script
|
My car is 8 tiles by 11 tiles at direction 0, and the equation I tried was:
PHP Code:
|
Quote:
PHP Code:
|
as far an a standered equation .... it does exisit esp considering everyone has diffrent img sizes , its not like getting the x and y of directly in front of a player which pretty much everyone uses the same one cause player size doesnt change , unless your using kingdom bodies, but never the less if its a new equation you have to just figure out an equation that will support what your tring to do, which can be done by a vast knowledge of math or trial and error process
|
matrix of revolution
old_dx = vehicle_midx - middle_playerx old_dy = vehilcle_midy - middle_playery sin = sin(change_in_angle_of_car) cos = cos(change_in_angle_of_car) new_dx = old_dx*cos-old_dy*sin new_dy = old_dy*cos+old_dx*sin array = {-1,0, 1,0, -1,-1, 1,-1} holding the values of player position for each seat in car when car direction = 3 (theta = 0) sin = sin(angle_of_car) cos = cos(angle_of_car) new_dx = array[player_pos_in_car*2]*cos-array[player_pos_in_car*2+1]*sin new_dy = array[player_pos_in_car*2+1]*cos+array[player_pos_in_car*2]*sin non-matrix of revolution array = {1,pi/4, 1,3*pi/4} array of playerpos in car using polar coordinates new_dx = array[player_pos_in_car*2]*cos(array[player_pos_in_car*2+1]+angle_of_car) new_dy = array[player_pos_in_car*2]*sin(array[player_pos_in_car*2+1]+angle_of_car) |
| All times are GMT +2. The time now is 02:14 PM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.