首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >ursina导入的obj模型贴图朝内,怎么办?

ursina导入的obj模型贴图朝内,怎么办?

提问于 2024-05-13 21:17:02
回答 0关注 0查看 26

我用ursina导入的obj文件和贴图显示正常,但在运行时贴图方向朝内,怀疑是发线方向错误

程序展示效果
程序展示效果
程序展示效果
程序展示效果

但是在blender里查看又没错

注:蓝色区域是贴图朝外部分红色区域是贴图朝内部分

Blender模型展示
Blender模型展示

大佬们怎么办?急!

模型文件

模型和文件

提取码:5sr5

代码

代码语言:python
代码运行次数:0
复制

import random
from ursina import *
from ursina.prefabs.first_person_controller import FirstPersonController


def input(key):
    if key == 'escape':
        quit()

def update():
    global firearm, drop_position
    if firearm == 0:
        if held_keys['e']:
            firearm = 1
    else:
        if held_keys['q']:
            firearm = 0
            #drop_position = player.camera_pivot

    if firearm == 1:
        gun.parent = player.camera_pivot
        gun.position = Vec3(0.8, -1.2, 1.5)
        gun.rotation = Vec3(0, 275, 0)
    else:
        gun.position = drop_position

#创建窗口
firearm = 0
drop_position = (0, 3, 0)
app = Ursina()
Sky()#Ursina自带的天空背景
boxes = []

ground = Entity(model="plane",
                scale=(100, 1, 100),  # 设置大小
                texture='grass3_texture.png',
                texture_scale=(20, 20),
                position=(0, 0, 0),
                collider="box")

'''house = Entity(model="./cottage/Snow covered CottageOBJ.obj",
               texture='./cottage/Texture/Cottage Texture.jpg',
               position = (20, 0, 20),
               scale=0.1,
               collider='box')'''

for i in range(16):
    Entity(model='cube',
           scale_x=2,
           scale_z=2,
           scale_y=random.uniform(2, 3),
           texture='brick2_texture.png',
           origin_y=-0.5,
           x=random.uniform(-16, 16),
           z=random.uniform(0, 32),
           collider='box')

player = FirstPersonController(model='cube',
                               color=color.orange,
                               z=-10,
                               origin_y=0.5)

gun = Entity(parent=scene,
             model='./AK47/scenes/AK47.obj',
             texture='./AK47/sourceimages/1st Texture/color.tga',
             recompute_normals=False,
             scale=0.02)

app.run()

回答

和开发者交流更多问题细节吧,去 写回答
相关文章

相似问题

相关问答用户
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档