簡體   English   中英

如何獲得ursina中實體的高度?

[英]how to get height of an entity in ursina?

我正在使用 python 中的 Ursina 制作 Brick Breaker 游戲。 我創建了一些用作球和桿的實體。

bar = Entity(model='quad', color=color.blue, position=(4.5, -10, 0), scale=(3, 0.3), collider='box')

ball = Entity(model='sphere', color=color.red, position=(4.5, -9.5, 0), scale=0.25, collider='sphere')

我希望球位於條形的上部中心,而無需手動設置 x 和 y 值。 像這樣:

我的想象力

為此,我想要欄的寬度和高度。 我怎樣才能得到它? 我試過bar.width 但它返回“實體”對象沒有屬性“寬度”

是的,有可能。 您可以使用bar.scale_xbar.scale_y

有關更多選項,您可以查看https://www.ursinaengine.org/api_reference並查看實體 ( https://www.ursinaengine.org/api_reference#Entity )

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM