0

Hi i have made a class Point in python

import json
from copy import deepcopy
from pygame.math import Vector3
class Point(Vector3):
    def __init__(self,xyz,**kwargs) -> None:
        super().__init__(xyz)
        self.pos = (self.x,self.y,self.z)
        for key in kwargs.keys():
            setattr(self,key,kwargs[key])
    def __tuple__(self):
        return tuple(self.pos)
    def __hash__(self):
        return hash(json.dumps(deepcopy(self.__dict__), sort_keys=True))
    def subtractpoint(self,point):
        return Point((self.x - point.x),(self.y - point.y),(self.z - point.z))
    def __iter__(self):
        return tuple([self])
    def calcrot(self,point) -> tuple:
        x,y,z = point.x,point.y,point.z
        rotx = math.atan2( y, z )
        roty = math.atan2( x * math.cos(rotx), z )
        rotz = math.atan2( math.cos(rotx), math.sin(rotx) * math.sin(roty) )
        return (rotx,roty,rotz)

And i do not know how to make it go forward relative to a pitch yaw rotation. I want to make something like a raycaster which can go forward and backward and see whats in front of it and in what it bumps to.

Radiant
  • 31
  • 4

0 Answers0